Index: /extensions/Autosize/admin/admin_autosize.php
===================================================================
--- /extensions/Autosize/admin/admin_autosize.php	(revision 8910)
+++ /extensions/Autosize/admin/admin_autosize.php	(revision 8911)
@@ -115,34 +115,29 @@
 case 'autosize_help': 
 
- $message="<fieldset id='fieldset'>
+ $message="
     <script id='dimensions' src='./plugins/Autosize/js/jquery.dimensions.js'></script>
     <script id='Affiche_script' src='./plugins/Autosize/js/Affiche_script.js'></script>
+    <fieldset id='fieldset'>
     <div class='autosize' 
-         autosize='MargeBasse:30px;MargeHaute:30px;parent:fieldset;ResizePicture:true'
-         >
-
-        <img src='./galleries/Voyages/Europe/Italie/Chianti/IMG_0520.JPG' width='100%' />
-        </a>
+         autosize='MargeBasse:30px;MargeHaute:30px;parent:fieldset;ResizePicture:true'>
+        <img src='./plugins/Autosize/images/ECO_050.jpg ' width='100%' />       
     </div>
 </fieldset>"; 
     if (isset($_POST['valid']))  {    	$message = empty($_POST['texte']) ? $message : stripslashes($_POST['texte']);
 	}	
-    //=========================================================================		
-	 	$toolbar = 'Basic';
-  		$width = '100%';
-  		$height = '200px';
+    //=========================================================================	
+   
+
+     $toolbar = 'Full';		//basic 
+  		$width = 'auto';
+  		$height = 'auto';
   		$areas = array();
   		$areas[]='texte';
 		if (!empty($areas)){
   				if (function_exists('set_fckeditor_instance'))
-    				set_fckeditor_instance($areas, $toolbar, $width, $height);
+                {  $template->set_prefilter('plugin_admin_content', 'add_remove_button');
+    				 set_fckeditor_instance($areas, $toolbar, $width, $height);
+                    }
   			}
-		 
-
-
-
-
-   
-
 
  $template->set_filenames(array( 'plugin_admin_content' => realpath(AUTOSIZE_PATH . 'admin/template/help.tpl' )));
Index: /extensions/Autosize/autosize.inc.php
===================================================================
--- /extensions/Autosize/autosize.inc.php	(revision 8910)
+++ /extensions/Autosize/autosize.inc.php	(revision 8911)
@@ -25,4 +25,13 @@
    PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/'
 );
+if (!defined('ROOT_URL')) 
+define(  'ROOT_URL',  get_root_url().'/' );
+if (!defined('AUTOSIZE_PATH_ABS')) 
+define(
+  'AUTOSIZE_PATH_ABS',
+   dirname(__FILE__).'/'
+);
+
+
 
 class autosize_controler {
@@ -37,4 +46,5 @@
 		$ma_page=isset($page['body_id'])?$page['body_id']:"" ;
  		if ($ma_page=='thePiwiShackControllerPage') return ;
+
 	    $my_path = dirname(__FILE__).'/';
 		$template->set_filenames(array('autosize_init'=>$my_path. "template/conflit.tpl" ) );	
@@ -42,5 +52,8 @@
 		$autosize_parametres =	 cl_autosize_Get_Options() ;			
 		$theme=$user['theme'];
-		$url = get_root_url();   		 
+		$url = get_root_url();   
+        $AUTOSIZE_PATH=AUTOSIZE_PATH;	
+      
+
   		$template->assign(
   						array(   
@@ -49,8 +62,10 @@
 						'cl_version' => $cl_plugin['version'] ,
 						'name' => $cl_plugin['name'] ,						 
-						'MY_ROOT' => $url,
 						'theme' => $theme  ,
 						'DEBUG' => $DEBUG   ,
-						'AUTOSIZE_PATH' => AUTOSIZE_PATH)
+                         'AUTOSIZE_PATH' => AUTOSIZE_PATH  ,
+                         'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS,
+                         'ROOT_URL' => $url  ,
+						)
 						 );
  
@@ -63,5 +78,5 @@
  static public function cl_autosize_script_2()
  {
-	   global  $template,$user,$conf,$picture ,$page, $cl_plugin ;
+	   global  $template,$user,$conf,$picture ,$page, $cl_plugin,$known_script ;
 			$my_path = dirname(__FILE__).'/';
 			$DEBUG =  isset($conf['cl_debug']) ? $conf['cl_debug'] : "false"  ; 
@@ -109,5 +124,5 @@
 	static public function cl_autosize_affiche()
 	{
-		global $user, $picture, $template,$page;
+		global $user, $picture, $template,$page,$known_script;
 		global $content, $element_info;   
 		global $infos_message,$erreur_message;
@@ -119,5 +134,6 @@
 			if ( isset($picture['current'])){	
 				$autosize_parametres = cl_autosize_Get_Options();
-				include (AUTOSIZE_PATH."include/affiche.php"); 		
+				include (AUTOSIZE_PATH."include/affiche.php"); 
+                		
 				if($autosize_parametres->check_icon_v == 'on'){				 
 						$template->assign('cl_autosize_button', 
Index: /extensions/Autosize/include/affiche.php
===================================================================
--- /extensions/Autosize/include/affiche.php	(revision 8910)
+++ /extensions/Autosize/include/affiche.php	(revision 8911)
@@ -1,6 +1,3 @@
 <?php  
-
-	
-
 $visible=(isset($visible))?$visible:false;
 $img_width=isset($picture['current']['width'])?$picture['current']['width']:480;
@@ -13,8 +10,9 @@
 $DEBUG= isset($conf['cl_debug']) ? $conf['cl_debug'] : $DEBUG ; 
  
-
+ $my_path = AUTOSIZE_PATH_ABS;
 $theme=$user['theme'];
 $user_status = $user['status'] ;
-                   $template->assign( array(
+ 
+                   $template->assign( array( 'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS
 											)
 									);		
@@ -29,5 +27,5 @@
 					'thumbnail' => $conf['prefix_thumbnail'],
                     'visible' => $visible,
-
+                     'ROOT_URL' => get_root_url()  ,
                     'AUTOSIZE_PATH' => AUTOSIZE_PATH,
                     'theme' => $theme,
Index: /extensions/Autosize/js/Affiche_script.js
===================================================================
--- /extensions/Autosize/js/Affiche_script.js	(revision 8910)
+++ /extensions/Autosize/js/Affiche_script.js	(revision 8911)
@@ -51,10 +51,10 @@
 function Wait_Affichage() {
     fade_in = parseInt(fade_in);
-   
+
     if (!jQuery().newResize()) {
         setTimeout("Wait_Affichage()", 500);
         return
     }
- nu_img++;
+    nu_img++;
     if (fade_in == 0) {
         jQuery(Parent).css({ opacity: "1" });
@@ -73,8 +73,8 @@
                        }
               );
-                   }
-                   if (nu_img > 1) return;
-
-                  
+    }
+ //   if (nu_img > 1) return;
+
+
 
     img_h = jQuery(TheImg).height();
@@ -85,5 +85,5 @@
     jQuery("#ret_autosize").val(src_img);
 
-    jQuery("#ret_autosize").trigger('ON');
+    jQuery("#ret_autosize").trigger('ON', { width: img_w, height: img_w, theImage: TheImg, src_img: src_img });
 
 
@@ -97,10 +97,9 @@
 
 
-
     conf = jQuery(Obj).get(0).conf;
     Obj = jQuery(Obj).get(0).obj;
     myWindow = jQuery("#" + conf.parent).infos();
 
-    if (myWindow == 0) myWindow = jQuery(window).infos();
+    if (myWindow.width == 0) myWindow = jQuery(window).infos();
     marge_basse = 0;
     if (conf.MargeBasse)
@@ -108,24 +107,22 @@
             conf.MargeBasse
     );
+    marge_top = 0;
+    if (conf.MargeHaute)
+        marge_top = jQuery().Get_Val_int(
+            conf.MargeHaute
+    );
+
     info_Obj = jQuery(Obj).infos();
     h1_left = jQuery(Obj).absoluteLeft();
     h1_top = jQuery(Obj).absoluteTop();
-    if (typeof old_h1 == "undefined") old_h1 = 0;
-
-
 
     if (h1_top < info_Obj.height)
-        h1 = (myWindow.height - h1_top - marge_basse);
+        h1 = (myWindow.height - h1_top - marge_basse - marge_top);
     else
         h1 = (myWindow.height - marge_basse);
 
-    if (h1 == old_h1) return;
-    old_h1 = h1;
-
-    imgs = jQuery(Obj).find("img");
-    rap = jQuery(imgs).height() / jQuery(imgs).width();
-    w2 = (h1 / rap);
-
-    // ("source:" + message);
+
+    rap = info_Obj.height / info_Obj.width;
+    w2 = parseInt(h1 / rap);
 
     if (w2 < info_Obj.width)
@@ -134,23 +131,32 @@
         marginLeft = "auto";
 
-    jQuery(Obj).css({ width: "auto",
+    jQuery(Obj).css({ width: "auto",marginTop:marge_top,
         marginLeft: "auto", marginBottom: 0 + "px",
         verticalAlign: "middle", textAlign: "center"
     });
     jQuery(Obj).height(h1);
+
     //=============================================================
     if (conf.ResizePicture != "true") {
 
     } else
-        jQuery(imgs).each(function (i) {
-            img = jQuery(this);
-            rap = jQuery(this).height() / jQuery(this).width();
-            w2 = parseInt(h1 / rap);
-            if (w2 > 0 && h1 > 0 && img.length > 0) {
-                img.height(h1);
-                img.width(w2);
-            }
-
-        });
+        imgs = jQuery(Obj).find("img");
+    Obj_w = jQuery(Obj).width();
+    Obj_h = jQuery(Obj).height();
+
+    jQuery(imgs).each(function (i) {
+        img = jQuery(this);
+
+        info_img = { width: conf.width[i], height: conf.height[i] };
+        img_rap = conf.rap[i];
+
+        if (info_img.width > Obj_w) h1 = parseInt(Obj_w / img_rap);
+        else w2 = parseInt(Obj_h * img_rap);
+        if (w2 > 0 && h1 > 0 && img.length > 0) {
+            img.height(h1);
+            img.width(w2);
+        }
+
+    });
 
 
@@ -176,4 +182,18 @@
                     conf[jQuery.trim(tableau2[0])] = jQuery.trim(tableau2[1]);
                 }
+                imgs = jQuery(a).find("img");
+                rap = new Array();
+                width = new Array();
+                height = new Array();
+                jQuery(imgs).each(function (i) {
+                    img = jQuery(this);
+                    rap.push((img.width() / img.height()));
+                    width.push( img.width()   );
+                    height.push( img.height() );
+                });
+
+                conf['rap'] = rap;
+                conf['width'] = width;
+                conf['height'] = height;
 
                 List_autosize.push({ obj: a, conf: conf });
@@ -190,8 +210,13 @@
 
 function List_autosize_resize(event, ui) {
+    if (typeof wait_resize == "undefined") wait_resize = false;
+    if (wait_resize == true) return;
+
+    wait_resize = true;
     if (List_autosize.length == 0) return;
     for (i = 0; i < List_autosize.length; i++) {
         Autosize_resize(jQuery(List_autosize[i]));
     }
+    wait_resize = false;
 
 }
Index: /extensions/Autosize/js/conflit.js
===================================================================
--- /extensions/Autosize/js/conflit.js	(revision 8910)
+++ /extensions/Autosize/js/conflit.js	(revision 8911)
@@ -537,6 +537,2 @@
     //=== ajout des fonctions jQuery ===
     jQuery.extend($, jQuery);
-
-
-    //-------------------------------------------------------------- 
-
Index: /extensions/Autosize/main.inc.php
===================================================================
--- /extensions/Autosize/main.inc.php	(revision 8910)
+++ /extensions/Autosize/main.inc.php	(revision 8911)
@@ -12,4 +12,6 @@
 if (!defined('AUTOSIZE_PATH')) 
 define(  'AUTOSIZE_PATH',   PHPWG_PLUGINS_PATH.basename(dirname(__FILE__)).'/' );
+if (!defined('ROOT_URL')) 
+define(  'ROOT_URL',  get_root_url().'/' );
 //==================================================================
 	include(AUTOSIZE_PATH."include/constants.php"); 	   
Index: /extensions/Autosize/template/autosize.tpl
===================================================================
--- /extensions/Autosize/template/autosize.tpl	(revision 8910)
+++ /extensions/Autosize/template/autosize.tpl	(revision 8911)
@@ -1,8 +1,4 @@
 {html_head}  {* $Id: autosize/template/autosize.tpl  *}
-<!-- autosize/template/autosize.tpl  --> 
-    {known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js" now=1} 
-    {known_script id="jquery.cluetip" src=$ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.packed.js"}
-    {known_script id="dimensions" src=$AUTOSIZE_PATH|@cat:"js/jquery.dimensions.js"} 
-
+<!-- autosize/template/autosize.tpl  -->
  <script type="text/javascript">
     var src_img = '{$SRC_IMG}';
@@ -47,5 +43,9 @@
     var check_desc_v = '{$check_desc_v}';
  </script>
-{known_script id="Affiche_script" src=$AUTOSIZE_PATH|@cat:"js/Affiche_script.js"}
+{if PHPWG_VERSION < 2.2 }
+ {include file=$AUTOSIZE_PATH_ABS|@cat:'template/picture_2_1.tpl'}
+{else} 
+{include file= $AUTOSIZE_PATH_ABS|@cat:'template/picture_2_2.tpl'} 
+{/if}
 <link href="{$AUTOSIZE_PATH}css/autosize.css" rel="stylesheet" type="text/css" />
  <!--  << autosize/template/autosize.tpl   --> 
Index: /extensions/Autosize/template/conflit.tpl
===================================================================
--- /extensions/Autosize/template/conflit.tpl	(revision 8910)
+++ /extensions/Autosize/template/conflit.tpl	(revision 8911)
@@ -1,9 +1,12 @@
 {html_head} 
-<!--- cl_conflit/template/confilt.tpl ---> 
- {known_script id="jquery" src=$ROOT_URL|@cat:"themes/default/js/jquery.packed.js"  now=1} 
- {known_script id="dimensions" src=$AUTOSIZE_PATH|@cat:"js/jquery.dimensions.js"} 
- {known_script id="conflit_script" src=$AUTOSIZE_PATH|@cat:"js/conflit.js"} 
- {/html_head}
+{if PHPWG_VERSION < 2.2 }  
+    {include file=$AUTOSIZE_PATH_ABS|@cat:'template/header_2_1.tpl'} 
+ {else}
+    {include file= $AUTOSIZE_PATH_ABS|@cat:'template/header_2_2.tpl'}
+ {/if}
+{/html_head}
+
 <script type="text/javascript">
+ 
  var DEBUG = '{$DEBUG}';
     var theme = '{$theme}';
Index: /extensions/Autosize/template/header_2_1.tpl
===================================================================
--- /extensions/Autosize/template/header_2_1.tpl	(revision 8911)
+++ /extensions/Autosize/template/header_2_1.tpl	(revision 8911)
@@ -0,0 +1,4 @@
+﻿{known_script id="jquery" src = $ROOT_URL|@cat:"themes/default/js/jquery.js" now=1} 
+{known_script id="jquery.cluetip" src = $ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.js"   } 
+{known_script id="conflit_script" src = $AUTOSIZE_PATH|@cat:"js/conflit.js"  } 
+{known_script id="dimensions" src = $AUTOSIZE_PATH|@cat:"js/jquery.dimensions.js"  } 
Index: /extensions/Autosize/template/header_2_2.tpl
===================================================================
--- /extensions/Autosize/template/header_2_2.tpl	(revision 8911)
+++ /extensions/Autosize/template/header_2_2.tpl	(revision 8911)
@@ -0,0 +1,5 @@
+﻿{combine_script id="jquery" load="header" path = $ROOT_URL|@cat:"themes/default/js/jquery.js"
+} {combine_script id="jquery.cluetip" path = $ROOT_URL|@cat:"themes/default/js/plugins/jquery.cluetip.js"
+require="jquery" } {combine_script id="conflit_script" path = $AUTOSIZE_PATH|@cat:"js/conflit.js"
+require="jquery"} {combine_script id="dimensions" path = $AUTOSIZE_PATH|@cat:"js/jquery.dimensions.js"
+require="jquery"} 
Index: /extensions/Autosize/template/picture.tpl
===================================================================
--- /extensions/Autosize/template/picture.tpl	(revision 8910)
+++ /extensions/Autosize/template/picture.tpl	(revision 8911)
@@ -20,7 +20,8 @@
 
  </script>
- <form method="post">
+ 
 <input id="ret_autosize"  type="hidden" value="" />
 <input id="src_img_h"  type="hidden" value="" />
 <input id="src_img_w"   type="hidden" value="" />
-</form>
+
+ 
Index: /extensions/Autosize/template/picture_2_1.tpl
===================================================================
--- /extensions/Autosize/template/picture_2_1.tpl	(revision 8911)
+++ /extensions/Autosize/template/picture_2_1.tpl	(revision 8911)
@@ -0,0 +1,1 @@
+﻿{known_script id="Affiche_script" src=$AUTOSIZE_PATH|@cat:"js/Affiche_script.js"}
Index: /extensions/Autosize/template/picture_2_2.tpl
===================================================================
--- /extensions/Autosize/template/picture_2_2.tpl	(revision 8911)
+++ /extensions/Autosize/template/picture_2_2.tpl	(revision 8911)
@@ -0,0 +1,1 @@
+﻿{combine_script id="Affiche_script" path= $AUTOSIZE_PATH|@cat:"js/Affiche_script.js" require='jquery' }
