Index: /extensions/AMenuManager/amm_pip.class.inc.php
===================================================================
--- /extensions/AMenuManager/amm_pip.class.inc.php	(revision 11035)
+++ /extensions/AMenuManager/amm_pip.class.inc.php	(revision 11036)
@@ -79,5 +79,6 @@
         ($block=$menu->get_block('mbAMM_randompict'))!=null) and
         ($user['nb_total_images']>0) and
-        isset($this->config['amm_randompicture_title'][$user['language']])
+        isset($this->config['amm_randompicture_title'][$user['language']]) and
+        $this->displayRandomImageBlock
       )
     {
@@ -352,4 +353,6 @@
     $this->registeredBlocks=$this->getRegisteredBlocks(true);
 
+    if(!isset($this->registeredBlocks['mbAMM_randompict'])) $this->displayRandomImageBlock=false;
+
     foreach($blocks[0]->get_registered_blocks() as $key => $block)
     {
Index: /extensions/AMenuManager/amm_version.inc.php
===================================================================
--- /extensions/AMenuManager/amm_version.inc.php	(revision 11035)
+++ /extensions/AMenuManager/amm_version.inc.php	(revision 11036)
@@ -15,6 +15,6 @@
   if (!defined('PHPWG_ROOT_PATH')) die('Hacking attempt!');
 
-  define('AMM_VERSION',  '3.1.2');
-  define('AMM_VERSION2', '03.01.02');
-  define('AMM_GPC_NEEDED', '3.5.0');
+  define('AMM_VERSION',  '3.1.3');
+  define('AMM_VERSION2', '03.01.03');
+  define('AMM_GPC_NEEDED', '3.5.1');
 ?>
Index: /extensions/AMenuManager/js/amm_randomPictPublic.js
===================================================================
--- /extensions/AMenuManager/js/amm_randomPictPublic.js	(revision 11035)
+++ /extensions/AMenuManager/js/amm_randomPictPublic.js	(revision 11036)
@@ -1,6 +1,9 @@
 /**
- * randomPict
+ * randomPict v1.0.1
  *
- * release 1.0.0
+ * | release | date       |
+ * | 1.0.1   | 2011-05-24 | * mantis bug:2311
+ * |         |            |   . broken javascript if random pic set is empty 
+ * |         |            |
  */
 function randomPict(opt)
@@ -105,6 +108,14 @@
 $(document).ready(
   function ()
-  {
-    var rPict=new randomPict(randomPictOpt);
+  {    
+    var rPict;
+    if(typeof randomPictOpt!=='undefined')
+    {
+      rPict=new randomPict(randomPictOpt);
+    }
+    else
+    {
+      $('#mbAMM_randompict').remove();
+    }
   }
 );
Index: /extensions/AMenuManager/js/amm_randomPictPublic.min.js
===================================================================
--- /extensions/AMenuManager/js/amm_randomPictPublic.min.js	(revision 11035)
+++ /extensions/AMenuManager/js/amm_randomPictPublic.min.js	(revision 11036)
@@ -1,3 +1,3 @@
-/* file: amm_randomPictPublic.js - v1.0.0 | minified on 2011/01/31 with http://jscompress.com/ */
+/* file: amm_randomPictPublic.js - v1.0.1 | minified on 2011/05/24 with http://jscompress.com/ */
 function randomPict(opt)
 {var options={fixedHeight:0,pictures:[],showName:'n',showComment:'n',delay:0},properties={vIntervalID:0,vCurrentPict:0,nameDOM:'',commentDOM:'',img:new Image()},init=function(opt)
@@ -16,3 +16,3 @@
 {if(properties.nameDOM!='')$('#'+properties.nameDOM).html(options.pictures[properties.vCurrentPict].name);if(properties.commentDOM!='')$('#'+properties.commentDOM).html(options.pictures[properties.vCurrentPict].comment);$('#iammRPicLink').attr('href',options.pictures[properties.vCurrentPict].link);$('#iammRPicImg').attr('src',options.pictures[properties.vCurrentPict].thumb);computePositionTop();$('#iamm_ill0').fadeTo(200,1);});};init(opt);}
 $(document).ready(function()
-{var rPict=new randomPict(randomPictOpt);});
+{var rPict;if(typeof randomPictOpt!=='undefined'){rPict=new randomPict(randomPictOpt);}else{$('#mbAMM_randompict').remove();}});
Index: /extensions/AMenuManager/main.inc.php
===================================================================
--- /extensions/AMenuManager/main.inc.php	(revision 11035)
+++ /extensions/AMenuManager/main.inc.php	(revision 11036)
@@ -2,5 +2,5 @@
 /*
 Plugin Name: Advanced Menu Manager
-Version: 3.1.2
+Version: 3.1.3
 Description: Gestion avancée du menu / Advanced management of menu
 Plugin URI: http://piwigo.org
@@ -191,4 +191,10 @@
 |         |            |
 | 3.1.2   | 2011/05/15 | * add sv_SE language
+|         |            |
+| 3.1.3   | 2011/05/24 | * mantis bug:2311
+|         |            |   . broken javascript if random pic set is empty 
+|         |            |
+|         |            | * mantis bug:2312
+|         |            |   . randomPictureJS is loaded even if menu is hidden 
 |         |            |
 |         |            |
