Changeset 22360 for extensions/Autosize


Ignore:
Timestamp:
Apr 25, 2013, 2:56:51 PM (11 years ago)
Author:
cljosse
Message:

[extensions] Autosize update to piwigo 2.5 (fix bugs with pamooramics, charlies's )

Location:
extensions/Autosize
Files:
9 edited

Legend:

Unmodified
Added
Removed
  • extensions/Autosize/autosize.inc.php

    r22221 r22360  
    3131        } //function cl_autosize_admin
    3232
     33        /**************************
     34         * loc_begin_picture       *
     35        ***************************/
     36        static public function init_0(){
     37                global          $events ;
     38                $hasContent=(empty($content) )?'false':'true';
     39                if(empty($events)) $events = (object) '';
     40                $events->ligne=40;
     41                $events->event +=1;
     42                $events->function="init_0";
     43                $events->content=$hasContent;
     44                self::AfficheDebug();
     45        }
    3346
    3447        /**************************
     
    3649        **************************/
    3750        static public function autosize_calcContent($content,$element_info){
    38                 global $conf,$page, $template,$picture,$user;
     51          global $conf,$page, $template,$picture,$user;
    3952                global $defined_types,$pictureSelType,$pictureMap ,$pictureDeriv ,$liste_type,$SRC_IMG;
    40                 global $autosize_parametres,$user_status;
     53                global $autosize_parametres,$user_status,$events,$error_message,        $imgSizeWH;
    4154                //==============================================================================
    42                 global $DEBUG_autosize,$infos_message,$error_message;
    43                 if(preg_match("|event|", $DEBUG_autosize, $val))  $infos_message =  "autosize_calcContent, " ;
    44                 if(!realpath($element_info['path'])) return $content;
    45 
     55                global $infos_message,$error_message;
    4656                $ma_page=isset($page['body_id'])?$page['body_id']:"" ;
    4757                if ($ma_page !='thePicturePage') return ;
    48                 $default_size =  $conf['derivative_default_size'];
     58                if(!realpath($element_info['path'])){$error_message .= "Error path";};
     59                //==========================================================
     60                $current = $template->get_template_vars('current');
     61                if (!isset($current)) return ;         
     62    $default_size =  $conf['derivative_default_size'];
    4963                //============================================================
    5064                $types = array_intersect(array_keys(ImageStdParams::get_defined_type_map()), array("Autosize","SelMaxi"));
     
    5771                        unset (  $_COOKIE['autosize_reload']) ;
    5872                }
    59                 //=============================================================
     73
     74                //==============================================================
     75                $autosize_parametres = cl_autosize_Get_Options();       
    6076                self::get_cookies();
    61                 if(preg_match("|test|", $DEBUG_autosize, $val)) {
    62                         $infos_message .= "#65 autosize_calcContent: <br>";
    63                         if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ;
    64                         $infos_message .=  "SESSION:"  . cl_print_var($_SESSION) ;
    65                         $infos_message .=  "COOKIE:"  . cl_print_var($_COOKIE) ;
    66                         $infos_message .=  "GET:"  . cl_print_var($_GET) ;
    67                         $infos_message .= "POST:"  . cl_print_var($_POST) ;
    68       $infos_message .= "SERVER:"  . cl_print_var($_SERVER["HTTP_HOST"]) ;
    69                         $infos_message .= "$pictureDeriv $pictureSelType $pictureMap ";
    70                 }
    71                 //===================================================================
    72                 $current = $template->get_template_vars('current');
    73                 if (!isset($current)) return ;
    74                 //===============================================================
    75                 global $imgSizeWH;
     77                //=============================================================         
    7678                $derivative = $current['src_image'] ;
    7779                $imgSizeWH = $derivative->get_size();
    7880                $SRC_IMG    = $derivative->get_url();
    79 
    8081                $picture['current']['scaled_width']=$imgSizeWH[0];
    8182                $picture['current']['scaled_height']= $imgSizeWH[1];
     
    8384                $picture['current']['image_url']=$SRC_IMG;
    8485                $picture['current']['thumbnail']=$SRC_IMG;
    85 
     86                $hasContent=(empty($content) )?'false':'true';
    8687                //==============================================================
    87                 $autosize_parametres = cl_autosize_Get_Options();
     88                if(empty($events)) $events= (object) '';
     89                $events->ligne=89;
     90                $events->event +=1;
     91                $events->function="autosize_calcContent";
     92                $events->content=$hasContent;
     93                self::AfficheDebug();
    8894                return false ;
    8995        }//calc_content ;
    90 
    91 
    92 
    9396        /*********************
    9497         * INIT
    9598        *********************/
    96         static public function init_3(){
    97                 global $DEBUG_autosize,$infos_message,$error_message;
    98                 if(preg_match("|event|", $DEBUG_autosize, $val))  $infos_message .=  "init_3, " ;
    99 
    100         }
     99
    101100        static public function init_1($content, $image)
    102101        {
    103102                global $conf, $template, $page;
    104                 global $DEBUG_autosize,$infos_message,$error_message;
     103                global $theContainerHeight,$theContainerWidth;
     104                global $theMainImageWidth,$theMainImageHeight ;
     105                global $infos_message,$error_message;
    105106                if(!realpath($image['path'])) return $content;
    106                 if(preg_match("|event|", $DEBUG_autosize, $val))  $infos_message .=  "init_1, " ;
    107                 if(!isset($conf['AS_panorama'])) return $content;
    108                 if(  !is_array($conf['AS_panorama']) )                  return $content;
    109                 $asp = & $conf['AS_panorama'];
    110                 if(!isset($asp['in_mode_360'])) $asp['in_mode_360']="";
    111                 if(!isset($asp['in_mode_180'])) $asp['in_mode_180']="";
    112                 if ( !stristr($image['name'], $asp['in_mode_360']) and !stristr($image['name'], $asp['in_mode_180']) ) return $content;
    113                 $asp['min_viewport_width']=$_COOKIE['windowWidth'] -$_COOKIE['theImageLeft']-$_COOKIE['theImageRight'];
    114                 $asp['viewport_height']=$_COOKIE['windowHeight']-130 ;
    115                 $asp['start_position']= 10;
    116         }
     107                if(  isset($conf['AS_panorama'])  && is_array($conf['AS_panorama']))            {
     108                        $asp = & $conf['AS_panorama'];
     109                        if(!isset($asp['in_mode_360'])) $asp['in_mode_360']="";
     110                        if(!isset($asp['in_mode_180'])) $asp['in_mode_180']="";
     111                        if ( !stristr($image['name'], $asp['in_mode_360']) and !stristr($image['name'], $asp['in_mode_180']) ) return $content;
     112                        $asp['min_viewport_width']=$_COOKIE['windowWidth'] -$_COOKIE['theContainerLeft']-$_COOKIE['theContainerRight'];
     113                        $asp['viewport_height']=$_COOKIE['windowHeight']-130 ;
     114                        $asp['start_position']= 10;
     115                }
     116                if ( strstr( $content,"iframe")||strstr($content,"charlie" )){
     117                        $ncount=1;
     118                        $pattern = array();
     119                        $pattern[0] = '/width\:(.*)(\d+)px/';$replacement[0] = ""; // style charlie
     120                        $pattern[1] = '/height\:(.*)(\d+)px/';$replacement[1] = "";
     121                        $pattern[2] = '/width=\"(\d+)\"/';$replacement[2] = ' ';
     122                        $pattern[3] = '/height=\"(\d+)\"/';$replacement[3] = ' ';
     123                        $pattern[4] = '/WIDTH=\"(\d+)\"/';$replacement[4] = ' ';
     124                        $pattern[5] = '/HEIGHT=\"(\d+)\"/';$replacement[5] = ' ';               
     125
     126                        // raz dimensions
     127                $content=  preg_replace($pattern, $replacement, $content);
     128                $remplace=" width='100%' height='".  $theMainImageHeight ."' ";
     129                        //<!-- /charlie_flvstreamer.tpl -->
     130 
     131                        if (strstr($content,"charlie" )){
     132         global $charlie;
     133          if(isset($charlie)){
     134          //  $theMainImageWidth=   $charlie['video_default_width'] ;
     135          //   $theMainImageHeight = $charlie['video_default_height'];
     136          }
     137
     138                                $content=str_replace( "<object" , "<object " . $remplace ,$content );
     139                                $content=str_replace( "<embed" ,  "<embed " . $remplace ,$content );
     140                                $content=str_replace( 'id="video"',"id='theMainImage_vid'  " .$remplace  ,$content,$ncount);
     141                                $content=str_replace( '<video"',"<video id='theMainImage_vid' " .$remplace  ,$content,$ncount);
     142                        }else{
     143                                $content=str_replace( "<iframe" ,  "<iframe id='iframe' " .$remplace   ,$content,$ncount);
     144                        }
     145         
     146                        $content= "<div id='theMainImage' style='border:5px solid red'>". $content . "</div>";
     147
     148                }
     149   
     150                global $events;
     151                $hasContent=(empty($content) )?'false':'true';
     152                if(empty($events)) $events= (object) '';
     153                $events->ligne=151;
     154                $events->event +=1;
     155                $events->function="init_1";
     156                $events->content=$hasContent;
     157                self::AfficheDebug();
     158                return $content;
     159        }//init_1
    117160        /*********************/
    118161        static public function init($content,$element_info){
    119                 global $template,$version,$icon_path,$page,$picture,$conf;
    120                 global $user,$Css,$css_slideshow,$css_display,$liste_type;
    121                 global $has_pamoorama,$pictureSelType,$pictureDeriv,$pictureMap;
     162    global $template,$user,$conf;
     163          global $version,$icon_path,$page,$picture;
     164                global $Css,$css_slideshow,$css_display,$liste_type;
     165                global $pictureSelType,$pictureDeriv,$pictureMap;
    122166                global $warnings_message;
    123 
    124167                global $set_miniature,$imgSizeWH;
    125                 global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize;
    126                 //=======================================================
    127                 global $has_pamoorama  ;
    128                 global $DEBUG_autosize,$infos_message,$error_message;
    129                 if(!realpath($element_info['path'])) return $content;
    130                 if(preg_match("|event|", $DEBUG_autosize, $val))  $infos_message .=  "init, " ;
    131 
    132                 $has_pamoorama = isset($template->files['pamooramics_content'])?"true":"false";
    133                 $theme=$user['theme'];
    134 
     168                global $theContainerHeight,$theContainerWidth;
     169                global $theMainImageWidth,$theMainImageHeight ;
     170                global $theContainerLeft,$theContainerTop,$windowWidth,$windowHeight,$theMainImageSize;
     171   
     172                //=======================================================               
     173    if(!realpath($element_info['path'])) return $content;
     174    $theme=$user['theme'];
    135175                $Css = self::css($theme."-rules.css");
    136176                $css_slideshow=isset($Css['.Autosize']['slideshow'])?$Css['.Autosize']['slideshow']:"yes";
    137177                $css_display= isset($Css['.Autosize']['display'])?$Css['.Autosize']['display']:"block";
    138178                $default_size =  $conf['derivative_default_size'];
    139                 //============================================================
    140                 self::get_cookies();
    141                 //==============================================================
    142                 if(preg_match("|test|", $DEBUG_autosize, $val)) {
    143                         $infos_message .= "#133 <br>Init:SESSION:"  . cl_print_var($_SESSION) ;
    144                         if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ;
    145                         $infos_message .= "GET:"  . cl_print_var($_GET) ;
    146                         $infos_message .= "POST:"  . cl_print_var($_POST) ;
    147                         $infos_message .= "$pictureDeriv $pictureSelType $pictureMap ";
    148                         $infos_message .= cl_print_var($template,true);
    149                 }
    150                 $autosize_parametres = cl_autosize_Get_Options();
    151179                //=====================================================================
    152180                $current = $template->get_template_vars('current');
    153181                //=== Zone affichage ==
    154                 $windowWidth=$_COOKIE['windowWidth'] ;
    155                 $windowHeight=$_COOKIE['windowHeight'] ;
    156 
    157                 $theImageTop= isset($_COOKIE['theImageTop'])?$_COOKIE['theImageTop']:0;
    158                 $theImageLeft=isset($_COOKIE['theImageLeft'])?$_COOKIE['theImageLeft']:0;
    159 
    160                 $theImageRight=isset($_COOKIE['theImageRight'])?$_COOKIE['theImageRight']:0;
    161                 $theImageBottom=isset($_COOKIE['theImageBottom'])?$_COOKIE['theImageBottom']:0;
    162 
    163 
    164                 $theImageMargeWidth=isset($_COOKIE['theImageMargeWidth']) ? $_COOKIE['theImageMargeWidth']:0;
    165                 $theImageMargeHeight=isset($_COOKIE['theImageMargeHeight'])?$_COOKIE['theImageMargeHeight']:0;
    166 
    167                 $theImageMargeHeight -= 2;
    168                 if(isset($_COOKIE['theImageWidth'])){
    169                         $theImageWidth=    $_COOKIE['theImageWidth'];
    170                         $theImageHeight=  $_COOKIE['theImageHeight'] ;
    171                 }
    172                 $theImageWidth=    $windowWidth -  $theImageLeft - $theImageMargeWidth;
    173                 $theImageHeight=   $windowHeight - $theImageTop  - $theImageMargeHeight ;
     182                if( !isset($_COOKIE['windowWidth']   ) ||
     183                                !isset($_COOKIE['windowHeight']  ) ){
     184                         return ;
     185                }else{
     186                        $windowWidth = $_COOKIE['windowWidth'] ;
     187                        $windowHeight = $_COOKIE['windowHeight'] ;
     188                }               
     189    //=========================================================================================================
     190                $theContainerMargeWidth = isset($_COOKIE['theContainerMargeWidth']) ? $_COOKIE['theContainerMargeWidth']:0;
     191                $theContainerMargeHeight = isset($_COOKIE['theContainerMargeHeight'])?$_COOKIE['theContainerMargeHeight']:0;
     192
     193                $theContainerWidth =   isset($_COOKIE['theContainerWidth'])?$_COOKIE['theContainerWidth']:$windowWidth-$theContainerMargeWidth;
     194                $theContainerHeight =  isset($_COOKIE['theContainerHeight'])?$_COOKIE['theContainerHeight']:$windowHeight-$theContainerMargeHeight;
     195
     196                $theContainerTop= isset($_COOKIE['theContainerTop'])?$_COOKIE['theContainerTop']:0;
     197                $theContainerLeft=isset($_COOKIE['theContainerLeft'])?$_COOKIE['theContainerLeft']:0;
     198
     199                $theContainerRight=isset($_COOKIE['theContainerRight'])?$_COOKIE['theContainerRight']:$theContainerWidth;
     200                $theContainerBottom=isset($_COOKIE['theContainerBottom'])?$_COOKIE['theContainerBottom']:$theContainerHeight;
     201 
     202                $theMainImageWidth = isset($_COOKIE['theMainImageWidth'])?$_COOKIE['theMainImageWidth']:$theContainerWidth;
     203                $theMainImageHeight = isset($_COOKIE['theMainImageHeight'])?$_COOKIE['theMainImageHeight']:$theContainerHeight ;
    174204
    175205                if (isset($element_info['is_gvideo']) && $element_info['is_gvideo'] ){
    176                         $pictureDeriv=$default_size;
    177 
     206                        $pictureDeriv = $default_size;
    178207                }else{
    179 
    180 
    181208                        $retour = self::get_min_max() ;
    182 
    183                         $theMainImageSize = $retour->get_size();
    184                         $theMainImageWidth=   isset($_COOKIE['theMainImageWidth'])?$_COOKIE['theMainImageWidth']:$theMainImageSize[0];
    185                         $theMainImageHeight=   isset($_COOKIE['theMainImageHeight'])?$_COOKIE['theMainImageHeight']:$theMainImageSize[1] ;
    186 
    187                         if($theImageHeight!=0 && $theImageWidth!=0){
    188                                 $pictureDeriv=$retour->type ;
     209                        $theMainImageSize =   $retour->get_size();
     210                        $theRealImageWidth =  $theMainImageSize[0];
     211                        $theRealImageHeight = $theMainImageSize[1] ;
     212
     213
     214                        if($theContainerHeight!=0 && $theContainerWidth!=0){
     215                                $pictureDeriv = $retour->type ;
    189216                        }else{
    190                                 $pictureDeriv=$default_size;
    191                         }
    192                 }
    193 
    194                 if(preg_match("|test|", $DEBUG_autosize, $val)) {
    195                         $infos_message .=  "#208 <br>Init:SESSION:"  . cl_print_var($_SESSION) ;
    196 
    197                         if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ;
    198                         $infos_message .=  "Init: COOKIE:"  . cl_print_var($_COOKIE) ;
    199                         $infos_message .=  "GET:"  . cl_print_var($_GET) ;
    200                         $infos_message .=  "POST:"  . cl_print_var($_POST) ;
    201                         $infos_message .=("#201: ".$DEBUG_autosize);
    202                 }
    203                 $pattern = array();
    204                 if($has_pamoorama=="true"){
    205                         if(preg_match("|c1|", $DEBUG_autosize, $val)) echo  $theImageWidth . "x" . $theImageHeight ;
    206                         $pattern[0] = '/width\:(.*)(\d+),/';$replacement[0] = 'width:  '.$theImageWidth.' ,';
    207                         if(($theImageWidth!=0)){
    208                                 $content=  preg_replace($pattern, $replacement, $content);
    209                         }
    210                         if(preg_match("|c1|", $DEBUG_autosize, $val)) {
    211                                 echo "<!-- " . $theImageWidth . "x" . $theImageHeight . " " .cl_print_var($content) ." -->";
    212                                 self::Fin_php("#211: " . $DEBUG_autosize);
    213                         }
    214                         return  $content;
    215                 }
    216                 if(isset($_GET['map'])){
    217                         return  $content;
    218                 }
    219                 $pattern[0] = '/width\:(.*)(\d+)px/';$replacement[0] = 'width:100% ';
    220                 $pattern[1] = '/height\:(.*)(\d+)px/';$replacement[1] = 'height:100% ';
    221                 $pattern[2] = '/width=\"(\d+)\"/';$replacement[2] = ' ';
    222                 $pattern[3] = '/height=\"(\d+)\"/';$replacement[3] = ' ';
    223 
    224                 if ( strstr( $content,"iframe")||strstr($content,"charlie" )){
    225 
    226                         $pictureSelType="Autosize";
    227                         $pictureDeriv=$conf['derivative_default_size'];
    228 
    229                         $_COOKIE['picture_sel_type']=$pictureSelType;
    230                         $_COOKIE['picture_deriv']=$pictureDeriv;
    231 
    232                         $ncount=1;
    233                         if (strstr($content,"charlie" )){
    234                                 $content=str_replace( "<object" , "<object id='theMainImage_obj' name='theMainImage' "  ,$content,$ncount);
    235                                 $content=str_replace( "<embed" ,  "<embed id='theMainImage_emb' name='theMainImage' "  ,$content,$ncount);
    236                                 $content=str_replace( 'id="video"',"id='theMainImage_vid'  name='theMainImage' " ,$content,$ncount);
    237                                 $content=str_replace( '<video"',"<video id='theMainImage_vid'  name='theMainImage' " ,$content,$ncount);
    238                         }else{
    239                                 $content=str_replace( "<iframe" ,  "<iframe id='iframe' name='theMainImage' "  ,$content,$ncount);
    240                         }
    241                         $content=  preg_replace($pattern, "", $content);
    242 
    243                         $content= "<div id='theMainImage' style='height:".$theImageHeight."px  ;width:".$theImageWidth."px '>". $content . "</div>";
    244                         $content= "<style>#theImageAndInfos{height:auto;width:auto;position:relative}
    245                                         #theImage{height:auto;align:center;text-align:center;position:relative}
    246                                         #theMainImage{height:auto;align:center;text-align:center;position:static}
    247                                         #charlie{display:none }
    248                                         #iframe{display:none }
    249                                         </style>".$content;
    250                         return  $content;
    251                 }
    252 
    253                 $content=  preg_replace($pattern, "", $content);
    254 
     217                                $pictureDeriv = $default_size;
     218                        }
     219                }               
     220 
     221 $hasContent=( empty($content) )?"false":'true';
     222                self::save_cookies();
     223                //===============================================================================
     224                global          $events ;
     225                $events->ligne=210;
     226                $events->event +=1;
     227                $events->function="INIT";
     228                $events->content= $hasContent;
     229                self::AfficheDebug();
    255230                return  $content;
    256231        }//INIT
     
    264239                global $infos_message;
    265240                //content = photo
    266 
    267241                //=====================================================================
    268242                global  $has_pamoorama,$pictureSelType,$pictureDeriv;
    269                 global $DEBUG_autosize;
    270                 if(preg_match("|event|", $DEBUG_autosize, $val)) $infos_message .= "init2, ";
     243                global $theContainerHeight,$theContainerWidth;$theContainerLeft;
     244                global $theContainerTop,$windowWidth,$windowHeight,$theMainImageSize;
     245                global $theMainImageWidth,$theMainImageHeight ;
     246    //=====================================================================
    271247                if(!realpath($element_info['path'])) return $content;
    272                 global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize;
    273248                //-- si Autosize correction redim ---------------
    274249                $current = $template->get_template_vars('current');
    275250                if (!isset($current)) return ;
    276                 if($pictureSelType!="Autosize") return $content ;
    277                 $pattern =Array('/width=\"(\d+)\"/','/height=\"(\d+)\"/');
    278                 $replacement = Array('',"style='height:".$theImageHeight."px'");
    279                 $replacement = Array('',"");
    280                 $content= preg_replace($pattern, $replacement, $content);
    281                 if( $has_pamoorama=="true") return $content ;
    282 
    283                 if( !preg_match("|c1|", $DEBUG_autosize, $val) ) return $content ;
    284                 //************************  c1 ***************************************
    285                 echo "theMainImageWidth :" . $theMainImageSize[0] . " X " . $theMainImageSize[1]  . "<br >";
    286                 echo "theImageWidth :" . $theImageWidth . " X " . $theImageHeight . "<br >";
    287                 echo $infos_message."<br />";
    288                 $Ratio = $theMainImageSize[0]/$theMainImageSize[1];
    289 
    290                 $nh = intval($theImageWidth / $Ratio)  ;
    291                 $nw = intval($theImageHeight * $Ratio) ;
    292 
    293                 echo $nw . "x " . $nh ."<br />";
    294 
    295                 if($theMainImageSize[0] < $nw){
    296                         echo "HEIGHT " .$theImageHeight . "  WIDTH " .  $nw."<br />";
    297                 }
    298                 if($theMainImageSize[1] <  $nh ){
    299                         echo "HEIGHT " . $nh  . "  WIDTH " .  ($theImageWidth)."<br />";
    300                 }
    301 
    302                 $content=  $content . $pictureDeriv . " " .$pictureSelType;
    303                 echo "<div style='color:white;position:absolute;left:0;top:0;width:".$windowWidth ."px;height:" .$windowHeight."px;background-color:blue'>";
    304                 echo "left:".$theImageLeft."px;top:".$theImageTop."px;width:".$theImageWidth ."px;height:" .$theImageHeight."px;";
    305                 echo "<div style='position:absolute;left:".$theImageLeft."px;top:".$theImageTop."px;width:".$theImageWidth ."px;height:" .  $theImageHeight."px;background-color:green;'>";
    306                 self::Fin_php("#305 : " . $content + $DEBUG_autosize);
    307 
     251                $has_pamoorama = isset($template->files['pamooramics_content'])?"true":"false";         
     252                $pattern = array();$replacement = array();
     253                $hasContent=(empty($content) )?'false':"true";
     254    if($hasContent=="true"){   
     255                  if($has_pamoorama=="true"){
     256                          $pattern[0] = '/width\:(.*)(\d+),/';$replacement[0] = 'width:  '. $theMainImageWidth .', ' ;
     257                          if(($theContainerWidth!=0)){
     258                                  $content=  preg_replace($pattern, $replacement, $content,1 );
     259                          }
     260                  }else
     261        if(      preg_match("|\<!-- \/charlie_|", $content, $val) ) {
     262           $pattern[0] = '/\<br.\/>/';$replacement[0] = '' ;
     263          $content=  preg_replace($pattern, $replacement, $content  );
     264      }
     265        else     
     266        if($pictureSelType == "Autosize") {
     267                            $pattern =Array('/width=\"(\d+)\"/','/height=\"(\d+)\"/' );
     268                            $replacement = Array('',"style='height:".$theMainImageHeight."px'; " );
     269          $content= preg_replace($pattern, $replacement, $content);       
     270                  }
     271    }
     272   
     273
     274                global          $events ;
     275                $events->ligne=247;
     276                $events->event +=1;
     277                $events->function="INIT2";
     278                $events->content=$hasContent;
     279                self::AfficheDebug();
     280                return  $content;
    308281        } //INIT2
    309282        /***************************
     
    314287                include_once ( "include/functions_cookie.inc.php");
    315288                global $ma_page,$user,$element_info,$infos_message,$DEBUG_autosize;
    316                 global $pictureDeriv,$pictureSelType,$pictureMap;
     289                global $pictureDeriv,$pictureSelType,$pictureMap,$autosize_parametres;
    317290                global $conf;
    318291                $set_miniature = "<!DOCTYPE html><html><head>
    319                 <meta http-equiv='content-type' content='text/html; charset=UTF-8'/>
    320                 <script type='text/javascript' src='themes/default/js/jquery.min.js'></script>
    321                 <script type='text/javascript' src='plugins/Autosize/js/autosizeDetect.js'></script>
    322                 <script type='text/javascript' src='plugins/Autosize/js/autosize.cookie.js'></script>
    323                 <script type='text/javascript' src='themes/default/js/plugins/jquery.ajaxmanager.js'></script>";
     292                                <meta http-equiv='content-type' content='text/html; charset=UTF-8'/>
     293                                <script type='text/javascript' src='themes/default/js/jquery.min.js'></script>
     294                                <script type='text/javascript' src='plugins/Autosize/js/autosizeDetect.js'></script>
     295                                <script type='text/javascript' src='plugins/Autosize/js/autosize.cookie.js'></script>
     296                                <script type='text/javascript' src='themes/default/js/plugins/jquery.ajaxmanager.js'></script>";
    324297                $set_miniature .= "<script type='text/javascript' src='plugins/Autosize/js/autosize_ajax.js' id='autosize_ajax' >  </script >";
    325298                $set_var = "<script type='text/javascript'>\n var COOKIE_PATH =  '".cookie_path()."';\n";
     
    329302                        $set_var .= " var reload =  'true';\n";
    330303                }
     304                $set_var .= " var DEBUG_autosize =  '". $DEBUG_autosize . "';\n";
    331305                $set_var .= " var ret_id =  '". $id_ret . "';\n";
    332306                $set_var .= " var mapage =  '". $ma_page . "';\n";
     
    337311                $set_var .= " </script >";
    338312                $autoscript="</head>
    339                 <body onload=on_load() style='background-color:black;color:white;font-size:30px' >
    340                 please wait, loading($id_ret)... <div>";
    341                 $default_size =  $conf['derivative_default_size'];
     313                <body style='background-color:black;color:white;font-size:30px' >";
     314
     315                $autoscript.="<div> please wait, loading($id_ret)...<img src='themes/default/images/ajax-loader-big.gif' > <div>";
    342316                //=======================================================================
    343                 $pictureSelType = pwg_get_session_var('picture_sel_type',$default_size);
    344                 $pictureDeriv = pwg_get_session_var('picture_deriv',$default_size);
    345                 $pictureMap = pwg_get_session_var('picture_map',$default_size);
    346                 //=======================================================================
    347                 $autosize_parametres = cl_autosize_Get_Options();
    348                 $userst= $user['status']."_enabled" ;
    349                 $userst=$autosize_parametres-> $userst;
    350                 $usertype= $user['status']."_type" ;
    351                 $usertype = $autosize_parametres->$usertype;
    352                 if($userst=='off'){
    353 
    354                 }else{
    355                         if($usertype!="Autosize" && $usertype!="SelMaxi" ){
    356                                 $pictureSelType = $usertype;
    357                                 $pictureDeriv = $usertype;
    358                         }else if($autosize_parametres->defaut_type=="off"){
    359                                 $pictureSelType = pwg_get_session_var('picture_sel_type',"SelMaxi");
    360                         }else {
    361                                 $pictureSelType = pwg_get_session_var('picture_sel_type',"Autosize");
    362                         }
    363                 }
    364                 $autoscript.="$pictureSelType</div></body></html>";
     317                $autoscript.="<div>$pictureSelType</div></body></html>";
    365318                //============================================================
    366                 self::save_cookies();
     319                //self::save_cookies();
    367320                if( !isset($_COOKIE['picture_deriv'])  ){
    368321                        echo "INIT <pre>";
    369322                        print_r($_COOKIE);
    370                         self::Fin_php("#369:  No COOKIE['picture_deriv'] ".$DEBUG_autosize);
    371                 }
    372 
    373                 if(preg_match("|vue_init|", $DEBUG_autosize, $val)) {
    374                         $infos_message.="Reload: $userst <br> $usertype <br> autosize_parametres:"  . cl_print_var($autosize_parametres) ;
    375                         if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ;
    376                         echo "Reload: SESSION:"  . cl_print_var($_SESSION) ;
    377                         echo "Reload: COOKIE:"  . cl_print_var($_COOKIE) ;
    378                         echo "GET:"  . cl_print_var($_GET) ;
    379                         echo "POST:"  . cl_print_var($_POST) ;
    380                         self::Fin_php("#379: ".$DEBUG_autosize);
    381                 }
    382 
    383                 $infos_message.="Reload: $userst <br> $usertype <br> autosize_parametres:"  . cl_print_var($autosize_parametres) ;
    384                 if(!preg_match("|aff_init|", $DEBUG_autosize, $val)) {
    385                         $infos_message="";
    386                 }
     323                        self::Fin_php("#310:  No COOKIE['picture_deriv'] ");
     324                }
     325                //=========================================================================
    387326                echo $set_miniature ;
    388327                echo $set_var ;
    389328                echo $autoscript;
    390329                if (!isset($_COOKIE['autosize_reload'])  ){
    391                         self::Fin_php("#390:  Initialisation ".$DEBUG_autosize);
    392                 }                       
    393         }
     330                        self::Fin_php("#319:  Initialisation ".$DEBUG_autosize);
     331                }
     332        //      die();
     333        }
     334 
    394335
    395336        /************************
     
    399340                global $user,$page,$template,$cl_plugin,$cl_version;
    400341                global  $has_pamoorama,$css_slideshow;
    401                 global $pictureSelType,$pictureDeriv,$infos_message,$conf;
    402                 global $DEBUG_autosize;
    403                 if(preg_match("|event|", $DEBUG_autosize, $val)) {
    404                         $infos_message .= "cl_autosize_script_1, " ;
    405                 } ;
     342                global $pictureSelType,$pictureDeriv,$infos_message,$conf,$autosize_parametres;
    406343                $ma_page=isset($page['body_id'])?$page['body_id']:"" ;
    407344                if ($ma_page !='thePicturePage') return ;
    408345                if ( $has_pamoorama=="false" ) return ;
    409346                if ($page['slideshow']){
    410                         //==== mise à l'échelle ===
     347                        //==== mise à l'chelle ===
    411348                        $current = $template->get_template_vars('current');
    412349                        $default_size =  $conf['derivative_default_size'];
     
    417354                                $model=$default_size;
    418355                        }
    419       if(!isset($current['derivatives'][$model])){
    420       $model=$default_size;
    421       }
    422      
     356                        if(!isset($current['derivatives'][$model])){
     357                                $model=$default_size;
     358                        }
     359
    423360                        $selected_derivative =  $current['derivatives'][$model];
    424361                        $template->append('current', array(
     
    428365
    429366                }
    430 
    431 
    432 
    433367                $template->set_filenames(array('autosize_init'=>AUTOSIZE_PATH_ABS. "template/conflit.tpl" ) );
    434                 $autosize_parametres =   cl_autosize_Get_Options() ;
     368
    435369                $theme=$user['theme'];
    436370                //==============================================================================
     371                global $DEBUG_autosize;
    437372                $template->assign(
    438373                                array(
     
    450385                                )
    451386                );
    452                 if( preg_match("|c2|", $DEBUG_autosize, $val) ){
    453                         self::Fin_php( "449: " . $DEBUG_autosize);
    454                         return $content ;
    455 
    456                 }
     387                global          $events ;
     388    $hasContent=(empty($content))?'false':"true";
     389                $events->ligne=373;
     390                $events->event +=1;
     391                $events->function="cl_autosize_script_1";
     392                $events->content=$hasContent ;
     393                self::AfficheDebug();
    457394
    458395                return $template->parse( 'autosize_init', false);
     
    464401         * cl_autosize_script_2()
    465402        **************************************/
    466         static public function cl_autosize_script_2()
    467         {
    468                 global $css_slideshow;
    469                 global $pictureSelType,$pictureDeriv,$infos_message;
     403        static public function cl_autosize_script_2()   {
     404                global  $css_slideshow;
     405                global  $pictureSelType,$pictureDeriv,$infos_message;
    470406                global  $template,$user,$conf,$picture ,$page, $cl_plugin,$cl_version,$known_script ;
    471 
    472407                global  $has_pamoorama;
    473                 global $DEBUG_autosize;
    474                 if(preg_match("|event|", $DEBUG_autosize, $val)) {
    475                         $infos_message .= "cl_autosize_script_2, ";
    476                 } ;
    477408                $ma_page=isset($page['body_id'])?$page['body_id']:"" ;
    478409                if ($ma_page !='thePicturePage') return ;
    479 
    480410                $theme=$user['theme'];
    481                 if ($has_pamoorama=="false" ) return ;
    482                 if ($css_slideshow == "no" and isset($_GET['slideshow'])) return ;
    483                 $AUTOSIZE_PATH = dirname(__FILE__).'/';
    484                 //=====================================================================
    485                 $template->assign(
    486                                 array(
    487                                                 'cl_version' => $cl_version ,
    488                                                 'name' => $cl_plugin['name'] ,
    489                                                 'ma_page' =>    $ma_page,
    490                                                 'theme' => $theme  ,
    491                                                 'DEBUG_autosize' => $DEBUG_autosize   ,
    492                                                 'AUTOSIZE_PATH' => AUTOSIZE_PATH
    493                                 )
    494                 );
    495                 $autoscript="<script type='text/javascript'>
    496                                 /* cl_autosize_script_2 */
    497                                 if (typeof (save_framework) == 'function')
    498                                 save_framework('".$ma_page."');
    499 
    500                                                 </script>";
    501                 $template->append('footer_elements',$autoscript);
    502 
     411                if ($has_pamoorama == "true" ) {
     412                        if ($css_slideshow != "no" || !isset($_GET['slideshow'])) {
     413                                $AUTOSIZE_PATH = dirname(__FILE__).'/';
     414                                //=====================================================================
     415                                global $DEBUG_autosize;
     416                                $template->assign(
     417                                                array(
     418                                                                'cl_version' => $cl_version ,
     419                                                                'name' => $cl_plugin['name'] ,
     420                                                                'ma_page' =>    $ma_page,
     421                                                                'theme' => $theme  ,
     422                                                                'DEBUG_autosize' => $DEBUG_autosize   ,
     423                                                                'AUTOSIZE_PATH' => AUTOSIZE_PATH
     424                                                )
     425                                );
     426                                $autoscript="<script type='text/javascript'>
     427                                                /* cl_autosize_script_2 */
     428                                                if (typeof (save_framework) == 'function')
     429                                                save_framework('".$ma_page."');
     430                                                                </script>";
     431                                $template->append('footer_elements',$autoscript);
     432                        }
     433                }
     434                global          $events ;
     435    $hasContent=(empty($content) )?'false':'true';
     436                $events->ligne=433;
     437                $events->event +=1;
     438                $events->function="cl_autosize_script_2";
     439                $events->content=$hasContent ;
     440                self::AfficheDebug();
    503441                return ;
    504442        }// function cl_autosize_script_2
     
    509447        static public function cl_autosize_script_3() {
    510448                global  $has_pamoorama,$template,$page,$infos_message;
    511                 global $DEBUG_autosize;
    512                 if(preg_match("|event|", $DEBUG_autosize, $val)) {
    513                         $infos_message .= "cl_autosize_script_3, ";
    514                 } ;
    515449                $ma_page=isset($page['body_id'])?$page['body_id']:"" ;
    516450                if ($ma_page !='thePicturePage') return ;
    517 
    518                        
    519451                $template->func_combine_script(array('id'=>'my_script_2',
    520452                                'path'=> AUTOSIZE_PATH.'js/JScript.js',
    521453                                'require' => 'jquery'),
    522454                                $template->smarty);
    523 
    524455                $template->func_combine_css(array('id'=>'autosize.css',
    525456                                'path'=> AUTOSIZE_PATH.'css/autosize.css'
    526457                ));
    527 
    528 
    529458                $autoscript="<script type='text/javascript'>
    530459                                var COOKIE_PATH = '".cookie_path()."' ;
    531460                                                </script>";
    532461                $template->append('footer_elements',$autoscript);
    533                 if ($has_pamoorama=="false" ) return ;
    534 
    535                 $autoscript="<script type='text/javascript'>
    536                                 if (typeof (Ajout_Ajax) == 'function')
    537                                 Ajout_Ajax();
    538                                 </script>";
    539                 $template->append('footer_elements',$autoscript);
    540 
    541                        
     462                if ($has_pamoorama=="true" ) {
     463                        $autoscript="<script type='text/javascript'>
     464                                        if (typeof (Ajout_Ajax) == 'function')
     465                                        Ajout_Ajax();
     466                                        </script>";
     467                        $template->append('footer_elements',$autoscript);
     468                }
     469                global          $events ;
     470    $hasContent=(empty($content) )?'false':'true';
     471                $events->ligne=467;
     472                $events->event +=1;
     473                $events->function="cl_autosize_script_3";
     474                $events->content=$hasContent ;
     475                self::AfficheDebug();
    542476                return ;
    543477        }// function cl_autosize_script_3
     
    561495                global $autosize_parametres,$user_status;
    562496                global  $has_pamoorama,$pictureSelType,$pictureDeriv;
    563                 global $DEBUG_autosize;
     497                       
    564498                global $css_slideshow,$css_display;
    565                 if(preg_match("|event|", $DEBUG_autosize, $val)) {
    566                         $infos_message .=  "cl_autosize_affiche, " ;
    567                 } ;
     499
    568500                $ma_page=isset($page['body_id'])?$page['body_id']:"" ;
    569                 if ($ma_page !='thePicturePage') return ;
     501                if ($ma_page !='thePicturePage')    return ;
    570502                //============================================================
     503                global          $events ;
     504                $events->ligne=506;
     505                $events->event +=1;
     506                $events->function="cl_autosize_affiche";
    571507                self::save_cookies();
    572508
     
    574510                        $set_miniature = self::cl_autosize_nofile($set_miniature) ;
    575511                        $set_miniatures= explode("script",$set_miniature);
    576                         if(preg_match("|noGen|", $DEBUG_autosize, $val)) {
    577                                 if(count($set_miniatures)> 1 )
    578                                         $infos_message .= "PictureDeriv:" . $pictureDeriv. ' miniature:' . cl_print_var( $set_miniature);
    579                                        
    580                         }else {
    581 
    582 
    583                         } ;
    584512                        $template->append('footer_elements',$set_miniature);
    585513                }
     
    601529                        return ;
    602530                }
    603                 if($pictureSelType == $pictureDeriv ) {
    604                         if(preg_match("|event|", $DEBUG_autosize, $val)) {
    605                                 cl_aff_infos_plus();
    606                         } ;
    607 
    608                 }
    609 
    610531                if (defined('GMAPS_VERSION')) $gmaps_function="true";
    611532                else $gmaps_function="false" ;
    612 
    613 
    614 
    615533                $template->set_filenames(array('autosize_content_header'=> $file ));
    616534                $template->assign(      array( AUTOSIZE_PATH,$AUTOSIZE_PATH,
     
    664582                }
    665583                       
    666 
    667                 if(preg_match("|vue_cookies|", $DEBUG_autosize, $val)) {
    668 
    669                         $pictureSelType=$_COOKIE['picture_sel_type'];
    670                         $pictureDeriv=$_COOKIE['picture_deriv'];
    671                         $infos_message .= "cl_autosize_affiche: $pictureSelType  <--> $pictureDeriv \n" ;
    672 
    673                 }
    674 
    675                 if(preg_match("|test|", $DEBUG_autosize, $val)) {
    676                         $infos_message .= "#683 <br>cl_autosize_affiche:_COOKIE:"  . cl_print_var($_COOKIE) ;
    677                         $pictureMap=$_COOKIE['picture_map'];
    678                         $infos_message .= "<br />SelType:" . $pictureSelType."; pictureDeriv:".$pictureDeriv ."; pictureMap:".$pictureMap;
    679 
    680                         self::Fin_php("#676: ".$DEBUG_autosize);
    681                 }
     584       
     585                $events->ligne=584;
     586    $hasContent=(empty($content) )?'false':'true';
     587                //$events->event +=1;
     588                $events->function="cl_autosize_affiche";
     589                $events->content=$hasContent ;
     590                self::AfficheDebug();
    682591                cl_aff_infos_plus();
    683592                return $template->parse( 'autosize_content', false);
     
    855764        static public function get_min_max(){
    856765                global $liste_type,$img_all,$set_miniature,$template,$infos_message,$error_message,$has_pamoorama ;
    857                 global $theImageWidth,$theImageHeight,$pictureSelType,$pictureDeriv ;
     766                global $theMainImageWidth,$theMainImageHeight,$theContainerWidth,$theContainerHeight;
     767                global $pictureSelType,$pictureDeriv ;
    858768                global $DEBUG_autosize;
    859 
    860 
    861769                $current = $template->get_template_vars('current');
    862770                $liste_type="";
     
    865773                $defined_types = array_keys(ImageStdParams::get_defined_type_map());
    866774                foreach($defined_types as $type){
    867 
    868775                        if($type!="Autosize" && $type!="SelMaxi" ){
    869776                                $last_derivative= $type ;
     
    871778                                $i++;
    872779                        }
    873 
    874780                }
    875781                ;
     
    897803                // Liste mini maxi
    898804                //=============================================
     805                 
     806                if(preg_match("|get_infos|", $DEBUG_autosize, $val))
     807                        $infos_message .= "<br> get_min_max() $theMainImageWidth,$theMainImageHeight,$theContainerWidth,$theContainerHeight <br>" ;
     808
    899809                foreach ($img_all as $img_select){
    900810
     
    912822                                $nofile++ ;
    913823                                if(preg_match("|get_infos|", $DEBUG_autosize, $val))
    914                                         $infos_message .=$nofile ." " ;
    915                         }
    916                         if(preg_match("|get_minfos|", $DEBUG_autosize, $val))
    917                                 $infos_message .=$img_url . " " . $max_crop ." -> " . $img_type . " " . print_r($imgWH,true). " <br >";
    918 
     824                                        $infos_message .= " File: $nofile  <br>" ;
     825                        }
     826                               
    919827                        if(file_exists(PHPWG_ROOT_PATH.$img_url)){
    920828                        } // if file
     
    944852                        $liste_type[$img_type]=$img_type.",".$img_url.",".$imgWH[0] .",".$imgWH[1] ;
    945853                        if( $img_type==$pictureSelType){
    946                                 if(preg_match("|get_minfos|", $DEBUG_autosize, $val))     $infos_message .= $pictureSelType . " <--> " . $img_type ."<br >";
     854                                if(preg_match("|get_infos|", $DEBUG_autosize, $val))     $infos_message .= $pictureSelType . " <--> " . $img_type ."<br >";
    947855
    948856                                $SelType_image->type=$img_type;
     
    961869
    962870                        }
    963 
    964                         if($has_pamoorama==true)
    965                                 $test= ($imgWH[1] >  $theImageHeight)  ;
    966                         else
    967                                 $test= ($imgWH[1] >  $theImageHeight  && $imgWH[0] >  $theImageWidth);
     871                        $test=$imgWH[1] >=  $theMainImageHeight;
     872                         if($has_pamoorama!=true){
     873                                $test=( $imgWH[0] >=  $theMainImageWidth) && $test;             
     874                         }
     875                                //===================================================
    968876                        if($theImage_maxi==0)
    969                                 if( $test  ){
    970                                 $theImage_maxi=1;
    971                                 $maxi_image->type =   $img_type;
    972                                 $img_type=$img_select->get_type();
     877                                if( $test==true  ){
     878                                                $theImage_maxi=1;
     879                                                $maxi_image->type =   $img_type;
     880                                                $img_type=$img_select->get_type();
    973881                                if($img_type=="Original")
    974882                                        $maxi_image = $last_image;
     
    985893                                $mini_image->url  =  $mini_image->get_path();
    986894                        }
    987 
     895                        if(preg_match("|get_infos|", $DEBUG_autosize, $val)){
     896                                if (($imgWH[1] >= $theMainImageHeight))  $infos_message .="<span style='color:red'>";
     897                       
     898                                $infos_message .= ($imgWH[1] >= $theMainImageHeight)."  Maxi:" . $maxi_image->url
     899                                         . " ---------- ImageUrl: $img_url "
     900                                         . $max_crop ." -> " . $img_type . " <br>"
     901                                                . print_r($imgWH,true). " <br >";
     902                                if ($test)  $infos_message .="</span >";                               
     903                                }
    988904                } // for
    989905                //================================================
     
    992908                $imgSizeWH  =  $img_select->src_image->get_size();
    993909                $liste_type["Original"]="Original".",".$img_url.",".$imgSizeWH[0] .",".$imgSizeWH[1] ;
    994                        
    995910
    996911                $retour=(object)'' ;
     
    1024939                }
    1025940
    1026                 if(preg_match("|get_infos|", $DEBUG_autosize, $val))
    1027                         $infos_message .=$pictureSelType . " -> " . $retour->type . " : "  . $retour->url  ."<br >";
     941                if(preg_match("|get_minfos|", $DEBUG_autosize, $val))
     942                        $infos_message .= $pictureSelType . " -> " . $retour->type . " : "  .
     943                                        $retour->url  .
     944                                 cl_print_var($retour->get_size()) .  "<br >";
    1028945
    1029946                return $retour ;
     
    1049966                //=== verification fichiers absents ===
    1050967                global $infos_message,$error_message;
    1051                 global $theImageHeight,$theImageWidth,$theImageLeft,$theImageTop,$windowWidth,$windowHeight,$theMainImageSize;
     968                global $theContainerHeight,$theContainerWidth,$theContainerLeft,$theContainerTop,$windowWidth,$windowHeight,$theMainImageSize;
    1052969                global  $pictureDeriv;
    1053970                $ok=false ;
     
    11191036        ****************************/
    11201037        static public  function  get_cookies(){
    1121                 global $pictureDeriv,$pictureSelType,$pictureDeriv,$pictureMap,$DEBUG_autosize;
     1038                global $pictureDeriv,$pictureSelType,$pictureDeriv,$pictureMap,$conf,$autosize_parametres,$user;               
     1039                        $userst         = $user['status']."_enabled" ;
     1040                        $userst         =       $autosize_parametres->  $userst ;
     1041                        $usertype       = $user['status']."_type" ;
     1042                        $default_size =  $conf['derivative_default_size'];                     
     1043                        $usertype = $autosize_parametres->$usertype ;
     1044                        $pictureSelType =$default_size ;
     1045                        if($userst==$user['status']."_enabled" ){
     1046                       
     1047                        }else{
     1048                                if($usertype!="Autosize" && $usertype!="SelMaxi" ){
     1049                               
     1050                                }else if($autosize_parametres->defaut_type=="off"){
     1051                                        $pictureSelType = pwg_get_session_var('picture_sel_type',"SelMaxi");
     1052                                }else {
     1053                                        $pictureSelType = pwg_get_session_var('picture_sel_type',"Autosize");
     1054                                }
     1055                        }
     1056
    11221057                if(!isset($_COOKIE['picture_deriv'])){
    1123                         $pictureDeriv= pwg_get_session_var('picture_deriv');
    1124                         $pictureSelType = pwg_get_session_var('picture_sel_type');
    1125                         $pictureMap = pwg_get_session_var('picture_map') | $pictureDeriv;
    1126                 }else{
    1127                         $pictureDeriv = $_COOKIE['picture_deriv'];
    1128                         $pictureSelType = isset( $_COOKIE['picture_sel_type'])?$_COOKIE['picture_sel_type']:$pictureDeriv;
    1129                         $pictureMap =  isset($_COOKIE['picture_map'])?$_COOKIE['picture_map']:$pictureDeriv;
    1130                 }
    1131                 $_COOKIE['picture_sel_type']=$pictureSelType;
    1132                 $_COOKIE['picture_deriv']=$pictureDeriv;
    1133                 $_COOKIE['picture_map']=$pictureMap;
    1134                 if(!isset($_COOKIE['picture_deriv'] )){
    1135                         if(preg_match("|test_1|", $DEBUG_autosize, $val)) {
    1136                                 $infos_message .= "not COOKIE['picture_deriv'] -> reload(): <br>";
    1137                                 self::Fin_php("#1133 autosize_calcContent:" . $DEBUG_autosize );
    1138                         }
    1139                         unset($_COOKIE['autosize_reload']);
    1140                 }
    1141                 if (!isset($_COOKIE['autosize_reload'])  ){
    1142                         if(preg_match("|test_2|", $DEBUG_autosize, $val)) {
    1143                                 $infos_message .= "not COOKIE['autosize_reload'] -> reload(): <br>";
    1144                                 self::Fin_php("#1140 autosize_calcContent:" . $DEBUG_autosize);
    1145                         }
    1146                         self::reload("#1142");
    1147                 }
     1058                        $pictureDeriv   = pwg_get_session_var('picture_deriv',$default_size);
     1059                        $pictureSelType = pwg_get_session_var('picture_sel_type',$pictureSelType);
     1060                        $pictureMap     = pwg_get_session_var('picture_map') | $pictureDeriv;
     1061                }
     1062       
     1063                        $pictureDeriv   =  isset( $_COOKIE['picture_deriv']) ? $_COOKIE['picture_deriv']:$pictureDeriv;
     1064                        $pictureSelType =  isset( $_COOKIE['picture_sel_type'])?$_COOKIE['picture_sel_type']:$pictureSelType;
     1065                        $pictureMap     =  isset($_COOKIE['picture_map'])?$_COOKIE['picture_map']:$pictureDeriv;
     1066                self::save_cookies();           
     1067                if(   !isset($_COOKIE['picture_deriv'] ))
     1068                          unset($_COOKIE['autosize_reload']);
     1069                if (!isset($_COOKIE['autosize_reload'])  )
     1070                        self::reload("#1044");                 
    11481071        }
    11491072        /***************************
     
    11521075        static public  function  save_cookies(){
    11531076                global $pictureDeriv,$pictureSelType,$pictureDeriv,$pictureMap;
    1154 
    1155                 pwg_set_session_var('picture_deriv',$pictureDeriv);
     1077                pwg_set_session_var('picture_deriv',   $pictureDeriv);
    11561078                pwg_set_session_var('picture_sel_type',$pictureSelType);
    1157                 pwg_set_session_var('picture_map',$pictureDeriv);
     1079                pwg_set_session_var('picture_map',     $pictureDeriv);
    11581080                //============================================================
    11591081                setcookie( 'picture_sel_type',
    1160                 $pictureSelType,
    1161                 time()+5,
    1162                 cookie_path()
     1082                                                                $pictureSelType,
     1083                                                                time()+10,
     1084                                                                cookie_path()
    11631085                );
    11641086                //=============================================================
    11651087                setcookie( 'picture_map',
    1166                 $pictureDeriv,
    1167                 time()+5,
    1168                 cookie_path()
     1088                                                                $pictureDeriv,
     1089                                                                time()+10,
     1090                                                                cookie_path()
    11691091                );
    11701092                //============================================================
    11711093                setcookie( 'picture_deriv',
    1172                 $pictureDeriv,
    1173                 time()+5,
    1174                 cookie_path()
     1094                           $pictureDeriv,
     1095                           time()+10,
     1096                           cookie_path()
    11751097                );
    1176                 $_COOKIE['picture_sel_type']=$pictureSelType;
    1177                 $_COOKIE['picture_deriv']=$pictureDeriv;
    1178                 $_COOKIE['picture_map']=$pictureDeriv;
    1179         }
    1180 
    1181         static public function Fin_php($message_){
     1098                $_COOKIE['picture_sel_type'] = $pictureSelType;
     1099                $_COOKIE['picture_deriv']    = $pictureDeriv;
     1100                $_COOKIE['picture_map']      = $pictureDeriv;
     1101        }
     1102        //=========================================================
     1103        static function AfficheDebug(){
     1104                global $DEBUG_autosize,$infos_message,$error_message,$events,$autosize_parametres;
     1105                global $theContainerWidth, $theContainerHeight ,$theMainImageWidth,$theMainImageHeight ;
     1106                if(empty($events)) $events= (object) '';
     1107                if ( isset($_COOKIE['pwg_id']) ) unset ($_COOKIE['pwg_id']) ;
     1108                //$infos_message .=  cl_print_var($events) ;
     1109                if($events->event==2){
     1110                        if(preg_match("|help|", $DEBUG_autosize, $val)){
     1111                                $infos_message .=  "<span style='color:blue'>HELP<br>";
     1112                                $infos_message .="get_infos  <br>";
     1113                                $infos_message .="event <br>";
     1114                                $infos_message .="cookies_x <br>";
     1115                                $infos_message .="session_x<br>";
     1116                                $infos_message .="theMainImage_x -> theMainImage size<br>";
     1117                                $infos_message .="c1_x -> theContainer size<br>";
     1118                                $infos_message .="test_x -> GET,POST,SERVER<br>";
     1119                                $infos_message .="noresize  <br>";
     1120                                $infos_message .="newreload <br>";
     1121                                $infos_message .="parametres <br>";
     1122                                $infos_message .="end_x -> Fin<br>";
     1123                                $infos_message .=  "</span>";
     1124                        }
     1125                        if(preg_match("|cookies|", $DEBUG_autosize, $val)  && !preg_match("|cookies_|", $DEBUG_autosize, $val) )
     1126                                $infos_message .=  "COOKIE:$events->function[$events->event]"  . cl_print_var($_COOKIE) ;
     1127                               
     1128                if(preg_match("|newreload|", $DEBUG_autosize, $val)) {
     1129                        unset($_COOKIE['autosize_reload']);                     
     1130                        return ;
     1131                }
     1132                if(preg_match("|parametres|", $DEBUG_autosize, $val))
     1133                        $infos_message .= "$events->function[$events->event]" .  cl_print_var($autosize_parametres);
     1134                }
     1135                if(preg_match("|event|", $DEBUG_autosize, $val)){
     1136                        $infos_message .=  "<span style='color:red'>$events->function</span> [$events->event] $events->content, " ;
     1137                }
     1138                if(preg_match("|cookies_$events->event|", $DEBUG_autosize, $val))
     1139                        $infos_message .=  "COOKIE:$events->function[$events->event]"  . cl_print_var($_COOKIE) ;
     1140                if(preg_match("|session_$events->event|", $DEBUG_autosize, $val))  $infos_message .=  "SESSION:"  . cl_print_var($_SESSION) ;
     1141                if(preg_match("|theMainImage_$events->event|", $DEBUG_autosize, $val)) {
     1142                        $infos_message .=  "theMainImage:".$theMainImageWidth."x".$theMainImageHeight;
     1143                }
     1144
     1145                if(preg_match("|c1_$events->event|", $DEBUG_autosize, $val)) {
     1146                        $infos_message .="theContainerWidth Infos: " . $theContainerWidth . " x " . $theContainerHeight . " I1: " . $theMainImageWidth ." x ".$theMainImageHeight ;
     1147                }
     1148
     1149                if(preg_match("|test_$events->event|", $DEBUG_autosize, $val)) {
     1150                        $infos_message .= "$events->function: <br>";
     1151                        $infos_message .=  "GET:"  . cl_print_var($_GET) ;
     1152                        $infos_message .= "POST:"  . cl_print_var($_POST) ;
     1153                        $infos_message .= "SERVER:"  . cl_print_var($_SERVER["HTTP_HOST"]) ;
     1154
     1155                }
     1156
     1157                if(preg_match("|end_$events->function|", $DEBUG_autosize, $val)) {
     1158                        self::Fin_php("#1099: " . $DEBUG_autosize);
     1159                }
     1160
     1161
     1162        }
     1163        //=========================================================
     1164        static public function Fin_php($message_,$reload = true ){
    11821165                global  $infos_message;
    1183                 echo "End :".$message_."<br>";
    1184                 die($infos_message);
     1166                echo $infos_message."<br>";
     1167                die("End :".$message_."<br>");
    11851168        }
    11861169        //==================================================
  • extensions/Autosize/css/autosize.css

    r19937 r22360  
    1010   }
    1111#theImage img{
    12  
    13  
    1412 
    1513}
  • extensions/Autosize/include/affiche.php

    r19844 r22360  
    1212$cookies="' x '";
    1313global $imgSizeWH ;
    14 if(isset($_COOKIE['windowHeight'])){
    15 $windowHeight=$_COOKIE['windowHeight'];
    16 $windowWidth=$_COOKIE['windowWidth'];
    17 }else{
    18 $windowHeight=600;
    19 $windowWidth=800;
    20 }
    21 global $size ;
    22 
    23 if(!isset($imgSizeWH)){
    24  $imgSizeWH[0]=100;
    25 $imgSizeWH[1]=100;
    26 }
    27  
     14global          $events ,$windowHeight , $windowWidth;
     15global $size ;
     16global $DEBUG_autosize;
     17                global $autosize_parametres,$user_status;
     18                global  $has_pamoorama,$pictureSelType,$pictureDeriv;
     19//===========================================================================
    2820$size=  array(
    2921            'src_img_h' => $imgSizeWH[1],
     
    3224            'window_width' => $windowWidth
    3325          );
    34    
    35        
     26if($imgSizeWH[1]==0){
     27          print_r($size);
     28          }
     29          $ratio=$imgSizeWH[0]/$imgSizeWH[1];
     30        if(preg_match("|fin_affiche|", $DEBUG_autosize, $val)){
     31echo "<pre>";
     32echo $DEBUG_autosize.$infos_message."
     33";
     34print_r(explode(",","$infos_message"));
     35print_r($events);
     36
     37 echo  $pictureDeriv . " " . $pictureDeriv . " " . $pictureSelType;
     38
     39echo "WH: " . $windowHeight . "x " .$windowWidth;
     40print_r($imgSizeWH);
     41        print_r($_COOKIE);
     42
     43
     44die();
     45}       
     46
     47
    3648  $my_path = AUTOSIZE_PATH_ABS;
    3749  $theme=$user['theme'];
    3850 
    3951  $user_status = $user['status'] ;
    40                    $template->assign( array(
     52  $template->assign( array(
    4153                   'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS,
    4254                   'ROOT_URL' => ROOT_URL,
     
    5668    } 
    5769 $autosize_parametres = cl_autosize_Get_Options();
    58  //===========================================
    59 $COOKIE_PATH= cookie_path() ;
    60  global $DEBUG_autosize;
    61 
    6270          $user_type= get_user_status($user_status)."_type";
    6371          $user_type=  $autosize_parametres->$user_type ; 
     
    6876              $ideal_size[1]=$imgSizeWH[1];
    6977          }
     78
     79 //===========================================
     80$COOKIE_PATH= cookie_path() ;
     81
     82
    7083
    7184 $slide_show = isset($page['slideshow'])?$page['slideshow']:false;
     
    8598            'slide_show' => $slide_show,
    8699             
    87             'ratio' =>$imgSizeWH[0]/$imgSizeWH[1] ,   
     100            'ratio' =>$ratio ,   
    88101             
    89102            'webmaster_type' => array(
  • extensions/Autosize/js/Affiche_script.js

    r22292 r22360  
    77         **************************************************************************/
    88  jQuery(document).ready(function (jQuery) {
     9
    910    var Type_Img = "";
    1011    var theImg = "";
    11     var Zone_image = "";
     12    var Zone_image = {};
     13    // expire= x *24*60*60*1000
    1214    var OptionsCookie = jQuery.extend({}, { path: '/', expires: 1 });
    13 
    1415    /***************************************************************************
    1516    * test_theme("mont,pur") ...
     
    2526    **************************************************************************/
    2627    Save_cookies = function (parametres) {
     28
     29      if (!parametres) {
     30        jQuery.cookie('windowHeight', jQuery(window).height(), OptionsCookie);
     31        jQuery.cookie('windowWidth', jQuery(window).width(), OptionsCookie);
     32        jQuery.cookie('picture_deriv', options.pictureDeriv, OptionsCookie);
     33        jQuery.cookie('picture_sel_type', options.pictureSelType, OptionsCookie);
     34        jQuery.cookie('picture_map', options.pictureMap || options.pictureDeriv, OptionsCookie);
     35        return;
     36      }
    2737      parametres.windowHeight = jQuery(window).height();
    2838      parametres.windowWidth = jQuery(window).width();
     39      if (parametres.windowHeight) jQuery.cookie('windowHeight', parametres.windowHeight, OptionsCookie);
     40      if (parametres.windowWidth) jQuery.cookie('windowWidth', parametres.windowWidth, OptionsCookie);
     41      if (parametres.pictureDeriv) jQuery.cookie('picture_deriv', parametres.pictureDeriv, OptionsCookie);
     42      if (parametres.pictureSelType) jQuery.cookie('picture_sel_type', parametres.pictureSelType, OptionsCookie);
     43      if (parametres.pictureMap) jQuery.cookie('picture_map', parametres.pictureMap || parametres.pictureDeriv, OptionsCookie);
     44
     45      if (!Zone_image.container) return;
     46
     47      if (Zone_image.container.height) {
     48        parametres.theContainerWidth = Zone_image.container.width;
     49        parametres.theContainerHeight = Zone_image.container.height;
     50      }
     51      if (Zone_image.image.height) {
     52        parametres.theMainImageWidth = Zone_image.image.width;
     53        parametres.theMainImageHeight = Zone_image.image.height;
     54      }
     55      // if (infos_theMainImage.src == "none") return;
     56      // if (!theImg.src.match(RegExp(Zone_image.name, "gi"))) return;
    2957      try {
    30         if (parametres.pictureDeriv) jQuery.cookie('picture_deriv', parametres.pictureDeriv, OptionsCookie);
    31         if (parametres.pictureSelType) jQuery.cookie('picture_sel_type', parametres.pictureSelType, OptionsCookie);
    32         if (parametres.pictureMap) jQuery.cookie('picture_map', parametres.pictureMap, OptionsCookie);
     58        if (Zone_image.path) jQuery.cookie('img_calc', Zone_image.path, OptionsCookie);
    3359        if (parametres.imgSrc) jQuery.cookie('img_src', parametres.imgSrc, OptionsCookie);
     60        if (parametres.theContainerHeight) jQuery.cookie('theContainerHeight', parametres.theContainerHeight, OptionsCookie);
     61        if (parametres.theContainerWidth) jQuery.cookie('theContainerWidth', parametres.theContainerWidth, OptionsCookie);
     62
    3463        if (parametres.theMainImageHeight) jQuery.cookie('theMainImageHeight', parametres.theMainImageHeight, OptionsCookie);
    3564        if (parametres.theMainImageWidth) jQuery.cookie('theMainImageWidth', parametres.theMainImageWidth, OptionsCookie);
    36         if (parametres.theImageHeight) jQuery.cookie('theImageHeight', parametres.theImageHeight, OptionsCookie);
    37         if (parametres.theImageWidth) jQuery.cookie('theImageWidth', parametres.theImageWidth, OptionsCookie);
    38         if (parametres.windowHeight) jQuery.cookie('windowHeight', parametres.windowHeight, OptionsCookie);
    39         if (parametres.windowWidth) jQuery.cookie('windowWidth', parametres.windowWidth, OptionsCookie);
    40         if (parametres.theImageTop) jQuery.cookie('theImageTop', parametres.theImageTop, OptionsCookie);
    41         if (parametres.theImageLeft) jQuery.cookie('theImageLeft', parametres.theImageLeft, OptionsCookie);
    42         if (parametres.theImageRight) jQuery.cookie('theImageRight', parametres.theImageRight, OptionsCookie);
    43         if (parametres.theImageBottom) jQuery.cookie('theImageBottom', parametres.theImageBottom, OptionsCookie);
    44         if (parametres.theImageMargeZone) {
    45           jQuery.cookie('theImageMargeWidth', parametres.theImageMargeZone.width, OptionsCookie);
    46           jQuery.cookie('theImageMargeHeight', parametres.theImageMargeZone.height, OptionsCookie);
     65
     66        if (parametres.theContainerTop) jQuery.cookie('theContainerTop', parametres.theContainerTop, OptionsCookie);
     67        if (parametres.theContainerLeft) jQuery.cookie('theContainerLeft', parametres.theContainerLeft, OptionsCookie);
     68        if (parametres.theContainerRight) jQuery.cookie('theContainerRight', parametres.theContainerRight, OptionsCookie);
     69        if (parametres.theContainerBottom) jQuery.cookie('theContainerBottom', parametres.theContainerBottom, OptionsCookie);
     70        if (parametres.theContainerMargeZone) {
     71          if (parametres.theContainerMargeZone.width) jQuery.cookie('theContainerMargeWidth', parametres.theContainerMargeZone.width, OptionsCookie);
     72          if (parametres.theContainerMargeZone.height) jQuery.cookie('theContainerMargeHeight', parametres.theContainerMargeZone.height, OptionsCookie);
    4773        }
    4874      } catch (e) {
     
    5682    Get_cookies = function () {
    5783      parametres = {
     84        windowHeight: jQuery.cookie('windowHeight'),
     85        windowWidth: jQuery.cookie('windowWidth'),
     86
    5887        pictureDeriv: jQuery.cookie('picture_deriv'),
    5988        pictureMap: jQuery.cookie('picture_map'),
     
    6493        theMainImageWidth: jQuery.cookie('theMainImageWidth'),
    6594
    66         windowHeight: jQuery.cookie('windowHeight'),
    67         windowWidth: jQuery.cookie('windowWidth'),
    68 
    69         theImageHeight: jQuery.cookie('theImageHeight'),
    70         theImageWidth: jQuery.cookie('theImageWidth'),
    71         theImageTop: jQuery.cookie('theImageTop'),
    72         theImageLeft: jQuery.cookie('theImageLeft'),
    73         theImageBottom: jQuery.cookie('theImageBottom'),
    74         theImageRight: jQuery.cookie('theImageRight'),
    75         theImageMargeZone: { width: jQuery.cookie('theImageMargeWidth'),
    76           height: jQuery.cookie('theImageMargeHeight')
     95        theContainerHeight: jQuery.cookie('theContainerHeight'),
     96        theContainerWidth: jQuery.cookie('theContainerWidth'),
     97        theContainerTop: jQuery.cookie('theContainerTop'),
     98        theContainerLeft: jQuery.cookie('theContainerLeft'),
     99        theContainerBottom: jQuery.cookie('theContainerBottom'),
     100        theContainerRight: jQuery.cookie('theContainerRight'),
     101        theContainerMargeZone: { width: jQuery.cookie('theContainerMargeWidth'),
     102          height: jQuery.cookie('theContainerMargeHeight')
    77103        }
    78104
     
    86112    **************************************************************************/
    87113    Get_type_img = function (e) {
    88       // ====== détection du type d'images ======   
     114      // ====== détection du type d'images ======
    89115      if (jQuery("#charlie").length > 0) {
    90116        Type_Img = "charlie";
     
    94120      } else if (jQuery("#pamoorama").length > 0) {
    95121        Type_Img = "pamoorama";
     122        theMainImage_Id = "#pamoorama";
    96123        options.valide = true;
    97         infos_pamoorama = jQuery("#pamoorama").infos({ absolute: true });
    98 
    99124      } else if (jQuery("#map").length > 0 || jQuery("#mapPicture").length > 0) {
    100125        Type_Img = "map";
    101126      } else if (jQuery("#Panorama").length) {
    102127        Type_Img = "panorama";
    103       } else if ((jQuery("#theImage" + " iframe").length + jQuery("#theImage" + " object").length + jQuery("#theImage" + " embed").length) > 0) {
    104 
    105         if (jQuery("#theImage" + " object").length > 0) {
     128      } else if ((jQuery(theImage_id + " iframe").length + jQuery(theImage_id + " object").length + jQuery(theImage_id + " embed").length) > 0) {
     129
     130        if (jQuery(theImage_id + " object").length > 0) {
    106131          type_src = "object";
    107         } else if (jQuery("#theImage" + " embed").length > 0) {
     132        } else if (jQuery(theImage_id + " embed").length > 0) {
    108133          type_src = "embed";
    109134        } else {
    110135          type_src = "iframe";
    111136        }
    112         iframes = jQuery("#theImage" + " " + type_src);
     137        iframes = jQuery(theImage_id + " " + type_src);
    113138        var st_frame = true;
    114139        nbf = iframes.length;
    115         jQuery("#theImage" + " " + type_src).each(function (i) {
     140        jQuery(theImage_id + " " + type_src).each(function (i) {
    116141          if (this.src.match(RegExp("http", "gi")) || this.src.match(RegExp("javascript", "gi"))) {
    117142
     
    129154        }
    130155        // 'fb - xfbml - like - button
    131         objs = jQuery("#theImage" + " div").get(0);
     156        objs = jQuery(theImage_id + " div").get(0);
    132157        if (jQuery(objs).length > 0) {
    133158          id_0 = jQuery(objs).attr("id");
     
    147172
    148173
    149       } else if (jQuery("#theImage").find("img").length > 0) {
     174      } else if (jQuery(theImage_id).find("img").length > 0) {
    150175        Type_Img = "img";
    151       } else if (jQuery("#theImage" + "Box").find("img").length > 0) {
     176      } else if (jQuery(theImage_id + "Box").find("img").length > 0) {
    152177        Type_Img = "img";
    153178        Parent = Parent + "Box";
     
    165190    // ====================================
    166191    set_cl = function (Valid) {
    167       if (typeof Valid == "undefined") Valid = options.pictureSelType.match(RegExp("Autosize", "gi")) || false;
    168       if (typeof options.cl_visible == "undefined") return;
    169       if (typeof src1 == "undefined") return;
    170       if (options.cl_visible) src = src1;
    171       else src = src2;
    172       if (typeof options.pictureSelType != "undefined" && (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi")) {
    173         if (options.pictureSelType == "SelMaxi") src = src6;
    174       } else {
    175         Valid = false;
    176         src = src2;
    177         jQuery("#bp_cla span").text("");
    178       }
    179       if (options.cl_visible) {
    180         src_info = src3;
    181         src_infos_1 = src3;
    182       } else {
    183         src_info = src4;
    184         src_infos_1 = src5;
    185       }
    186       src_info = options.pictureDeriv;
    187       if (!Valid) {
    188         Zone_image.image.height = Zone_image.image_init.height;
    189         Zone_image.image.width = Zone_image.image_init.width;
    190 
    191       }
    192 
    193       if ((typeof Zone_image != "undefined") && typeof Zone_image.image != "undefined") {
    194         Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height);
    195         zoom_cl = parseInt(100 * Zone_image.zoom) + "%"; ;
    196         if (!Valid) {
    197           if (options.pictureSelType == "SelMaxi")
    198             zoom_cl = options.pictureSelType + " [" + options.pictureDeriv + "]";
    199           else {
    200             zoom_cl = "";
    201             src_info = options.pictureDeriv;
     192      if (typeof Valid == "undefined")
     193        Valid = options.pictureSelType.match(RegExp("Autosize", "gi")) || false;
     194      if (typeof options.cl_visible != "undefined" && typeof src1 != "undefined") {
     195        if (options.cl_visible) src = src1;
     196        else src = src2;
     197        if (typeof options.pictureSelType != "undefined" && (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi")) {
     198          if (options.pictureSelType == "SelMaxi") src = src6;
     199        } else {
     200          Valid = false;
     201          src = src2;
     202          jQuery("#bp_cla span").text("");
     203        }
     204        if (options.cl_visible) {
     205          src_info = src3;
     206          src_infos_1 = src3;
     207        } else {
     208          src_info = src4;
     209          src_infos_1 = src5;
     210        }
     211        src_info = options.pictureDeriv;
     212
     213
     214        if ((typeof Zone_image != "undefined") && typeof Zone_image.image != "undefined") {
     215          if (!Valid) {
     216            Zone_image.image.height = Zone_image.image_init.height;
     217            Zone_image.image.width = Zone_image.image_init.width;
     218
    202219          }
    203         }
    204         if (Type_Img == "pamoorama" || Type_Img == "iframe" || Type_Img == "charlie") {
    205           zoom_cl = "";
    206           src_info = "";
    207           src = src2;
     220          Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height);
     221          zoom_cl = parseInt(100 * Zone_image.zoom) + "%"; ;
     222          if (!Valid) {
     223            if (options.pictureSelType == "SelMaxi")
     224              zoom_cl = options.pictureSelType + " [" + options.pictureDeriv + "]";
     225            else {
     226              zoom_cl = "";
     227              src_info = options.pictureDeriv;
     228            }
     229          }
     230          if (Type_Img == "pamoorama" || Type_Img == "iframe" || Type_Img == "charlie") {
     231            // zoom_cl = "";
     232            // src_info = "";
     233            // src = src2;
     234          };
     235
     236          jQuery('#bp_cla').attr('alt', src_info);
     237          jQuery('#bp_cla').attr('title', src_info);
     238          jQuery('#bp_cla').attr('Stitle', src_info);
     239          jQuery('#bp_cla').attr('Stip', zoom_cl);
     240          jQuery('#bp_cla span').text(zoom_cl);
     241          color_back = jQuery('#imageToolBar').css("backgroundColor");
     242          try {
     243            if (color_back.match(new RegExp("rgb", "gi"))) {
     244              color_back = color_back.split("(")[1].split(")")[0].split(",");
     245              color_back = "rgb(" + Math.abs(255 - color_back[0]) + ","
     246                                        + Math.abs(255 - color_back[1]) + ","
     247                                        + Math.abs(255 - color_back[2]) + ")";
     248            }
     249            else if (color_back.match(new RegExp("#", "gi")))
     250              color_back = Math.abs("#65536" - color_back);
     251            else
     252              color_back = jQuery('body').css("color");
     253            jQuery('#bp_cla span').css({ color: color_back, aling: "center" });
     254          } catch (e) {
     255
     256          }
     257          jQuery("#derivativeSwitchBox span").removeClass("auto_details linkAutosize");
     258          jQuery("#derivativeSwitchBox a").removeClass("auto_details linkAutosize");
     259          if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
     260            spans = jQuery("#derivativeChecked" + options.pictureSelType).next();
     261            spans.addClass("linkAutosize");
     262            spans.find("span").addClass("auto_details");
     263            jQuery(".auto_details").text("");
     264          }
     265          if (options.pictureDeriv) {
     266            jQuery(".switchCheck").css({ visibility: "hidden" });
     267            if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
     268              jQuery("#derivativeChecked" + options.pictureSelType).css("visibility", "visible");
     269              jQuery("#derivativeChecked" + options.pictureDeriv + ".switchCheck").css({ visibility: "visible", color: "grey" });
     270            } else
     271              jQuery("#derivativeChecked" + options.pictureDeriv).css("visibility", "visible");
     272            jQuery('.auto_details').text(" (" + Zone_image.image.width + " x " + Zone_image.image.height + ") " + options.pictureDeriv);
     273          }
     274          // ===============================================
     275        } else {
     276          src = src6;
     277          jQuery('.auto_details').text("");
     278
     279        }
     280        bp_scr = jQuery('#bp_img_cla');
     281        if (bp_scr.length > 0) {
     282          src_enc = bp_scr.attr("src");
     283          if (!src_enc.match(src)) {
     284            bp_scr.get(0).src = src;
     285            jQuery('#bp_img_cla').attr('alt', src_info);
     286            jQuery('#bp_img_cla').attr('title', src_info);
     287          }
    208288        };
    209 
    210         jQuery('#bp_cla').attr('alt', src_info);
    211         jQuery('#bp_cla').attr('title', src_info);
    212         jQuery('#bp_cla').attr('Stitle', src_info);
    213         jQuery('#bp_cla').attr('Stip', zoom_cl);
    214         r = { width: jQuery("#theMainImage").width(), height: jQuery("#theMainImage").height(),
    215           rap: jQuery("#theMainImage").width() / jQuery("#theMainImage").height(),
    216           rap_init: Zone_image.image_init.rapport
    217         };
    218         jQuery('#bp_cla span').text(zoom_cl);
    219         color_back = jQuery('#imageToolBar').css("backgroundColor");
    220         try {
    221           if (color_back.match(new RegExp("rgb", "gi"))) {
    222             color_back = color_back.split("(")[1].split(")")[0].split(",");
    223             color_back = "rgb(" + Math.abs(255 - color_back[0]) + ","
    224                 + Math.abs(255 - color_back[1]) + ","
    225                 + Math.abs(255 - color_back[2]) + ")";
    226           }
    227           else if (color_back.match(new RegExp("#", "gi")))
    228             color_back = Math.abs("#65536" - color_back);
    229           else
    230             color_back = jQuery('body').css("color");
    231           jQuery('#bp_cla span').css({ color: color_back, aling: "center" });
    232         } catch (e) {
    233 
    234         }
    235         jQuery("#derivativeSwitchBox span").removeClass("auto_details linkAutosize");
    236         jQuery("#derivativeSwitchBox a").removeClass("auto_details linkAutosize");
    237         if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
    238           spans = jQuery("#derivativeChecked" + options.pictureSelType).next();
    239           spans.addClass("linkAutosize");
    240           spans.find("span").addClass("auto_details");
    241           jQuery(".auto_details").text("");
    242         }
    243         if (options.pictureDeriv) {
    244           jQuery(".switchCheck").css({ visibility: "hidden" });
    245           if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
    246             jQuery("#derivativeChecked" + options.pictureSelType).css("visibility", "visible");
    247             jQuery("#derivativeChecked" + options.pictureDeriv + ".switchCheck").css({ visibility: "visible", color: "grey" });
    248           } else
    249             jQuery("#derivativeChecked" + options.pictureDeriv).css("visibility", "visible");
    250           jQuery('.auto_details').text(" (" + Zone_image.image.width + " x " + Zone_image.image.height + ") " + options.pictureDeriv);
    251         }
    252         // ===============================================
    253       } else {
    254         src = src6;
    255         jQuery('.auto_details').text("");
    256 
    257       }
    258       bp_scr = jQuery('#bp_img_cla');
    259       if (bp_scr.length > 0) {
    260         src_enc = bp_scr.attr("src");
    261         if (!src_enc.match(src)) {
    262           bp_scr.get(0).src = src;
    263           jQuery('#bp_img_cla').attr('alt', src_info);
    264           jQuery('#bp_img_cla').attr('title', src_info);
    265         }
    266       };
    267       Affiche_limite(pictureSelType_user);
     289        if (typeof Affiche_limite != "function") return;
     290        Affiche_limite(pictureSelType_user);
     291      }
     292      Save_cookies(options);
    268293    };
    269294    // ____________________ set_cl _____________________________
     
    273298    **************************************************************************/
    274299    Set_llbgo = function (Force) {
    275 
    276300      if (options.marges_llgbo == 0) return;
    277       if (Type_Img == "pamoorama") {
    278 
    279       }
    280301      if (Force)
    281302        if (typeof LlgboFr_Resize == "function") {
     
    319340    // __________ Set_llbgo _______________
    320341    var wpng = 0;
    321     /***************************************************************************
    322     * window LOAD
    323     **************************************************************************/
    324     jQuery(window).load(function () {
    325       location_href = location.href;
    326       // =======================================================================
    327       infos_theImage = jQuery(theImage_id).infos({ absolute: true });
    328       infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });
    329       infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre
    330       // general
    331       the_mainImage_obj = "theMainImage_obj";
    332       infos_theMainImage_obj = jQuery("#" + the_mainImage_obj).infos({ absolute: true });
    333 
    334       infos_theMainImage_obj.rapport = infos_theMainImage_obj.width / infos_theMainImage_obj.height;
    335       if (infos_theMainImage.width == 0) {
    336         if (Type_Img == "pamoorama") {
    337           infos_theMainImage = jQuery("#pamoorama").infos(true);
    338           theMainImage_id = "#pamoorama";
    339           options.valide = true;
    340         } else if (Type_Img == "charlie") {
    341           infos_theMainImage = jQuery("#charlie").infos(true);
    342           theMainImage_id = "charlie";
    343           options.valide = true;
    344         } else if (Type_Img == "iframe") {
    345           infos_theMainImage = jQuery("#iframe").infos(true);
    346           options.valide = true;
    347           infos_theMainImage.width = infos_theImage.general.width;
    348           infos_theMainImage.height = infos_window.height - infos_theImage.top - options.marge_basse;
    349           jQuery("#iframe").width(infos_theMainImage.width);
    350           jQuery("#iframe").height(infos_theMainImage.height);
    351         } else {
    352           jQuery("img").each(function (i) {
    353             imgSrc = options.imgSrc;
    354           });
    355           infos_theMainImage = jQuery("#theImage img").infos();
    356         }
    357         if (infos_theMainImage.id == "")
    358           jQuery("#theImage img").attr("id", "theMainImage");
    359         infos_theMainImage = jQuery(theMainImage_id).infos();
    360       }
    361 
    362       infos_theImage = jQuery(theImage_id).infos(true);                 // conteneur
    363       if (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi") {
    364         jQuery('#derivativeSwitchLink').show();
    365       }
    366       if (test_theme("simple")) {
    367         jQuery(theMainImage_id).css({ maxWidth: "none" });
    368         theImageAndInfos_id = "#content";
    369         infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre
    370         // general
    371         infos_theImage.height = infos_window.height - infos_theImage.top;
    372         // jQuery(theImage_id).height(infos_theImage.height);
    373 
    374       } else {
    375         infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre
    376         // general
    377         if (infos_theImageAndInfos.visible == false)
    378           theImageAndInfos_id = "#imageContainer";
    379       }
    380 
    381 
    382       imageInfos_id = "#imageInfos";
    383 
    384       content_id = "#content";
    385       infos_content = jQuery(content_id).infos(true);                 // conteneur
    386       infos_theImage = jQuery(theImage_id).infos(true);                 // conteneur
    387       infos_imageInfos = jQuery(imageInfos_id).infos(true);             // information
    388       infos_theMainImage = jQuery(theMainImage_id).infos(true);         // Image
    389       infos_copyright = jQuery("#copyright").infos(true);
    390 
    391 
    392       if (infos_theImage.top > infos_window.height) {
    393         zheight = infos_window.height - infos_content.top;
    394       } else {
    395         zheight = infos_window.height - (infos_theImage.top);
    396       }
    397 
    398 
    399       if (options.check_desc_v) { }
    400 
    401       infos_comments = jQuery("#comments").infos(true);
    402       infos_Licence = jQuery(".licencetag").infos(true);
    403       infos_imageComment = jQuery(imageComment_id).infos(true);
    404 
    405 
    406 
    407       if (test_theme("simple")) {
    408 
    409 
    410       } else {
    411         if (test_theme("stripped")) {
    412 
    413         } else
    414 
    415           if (test_theme("blanc , pure, hr_ ")) {
    416             options.marge_gauche += 10;
    417             options.marge_droite += 10;
    418           }
    419       }
    420       Zone_image = { image_init: {
    421         width: infos_theMainImage.width,
    422         height: infos_theMainImage.height,
    423         rapport: infos_theMainImage.width / infos_theMainImage.height
    424       },
    425         image: {
    426           width: infos_theImage.general.width,
    427           height: infos_window.height - infos_theImage.top - options.marge_basse,
    428           rapport: infos_theMainImage.width / infos_theMainImage.height
    429         },
    430         container: {
    431           width: infos_theImage.general.width,
    432           height: zheight,
    433           margesWidth: infos_window.width - infos_theImage.width
    434         }, marges: {
    435           height: 0,
    436           width: 0
    437         }
    438       };
    439       Zone_image.zoom = (Zone_image.image.height / Zone_image.image_init.height);
    440 
    441       /***********************************************************************
    442       * RESIZE (une fois document chargé)
    443       **********************************************************************/
    444 
    445       jQuery(window).resize(function (event, ui) {
    446         Autosize_resize(true, options);
    447       });
    448       // _____________ widow.resize _______________
    449 
    450       type_src = "div";
    451       old_window = { width: 0, height: 0 };
    452       List_autosize = new Array();
    453       nu_img = 0;
    454       tempo = 0;
    455 
    456 
    457       infos_llgbo = jQuery(llgbo_id).infos(true);
    458       infos_llgboh2 = jQuery("#llgboh2").infos(true);
    459       marges_llgbo = 0;
    460       // ==========================================================================================
    461       init_gen();
    462     });
    463     // __________________window.onload_________________
    464 
    465     /***************************************************************************
    466     * window unLOAD
    467     **************************************************************************/
    468     jQuery(window).unload(function () {
    469    
    470       // return;
    471     });
    472     // _________ unload ___________
     342
    473343
    474344    // ===================
    475345    // VARIABLES
     346    // ===================
    476347
    477348
     
    482353      options = { imageAutosize: false };
    483354    }
     355    if (typeof Autosize_options == "undefined") return;
    484356    options = jQuery.extend(Autosize_options, options);
    485357
     
    511383    DEBUG_autosize = options.DEBUG_autosize;
    512384    OptionsCookie = jQuery.extend({}, { path: options.COOKIE_PATH, expires: 1 });
     385
    513386    var cookies = Get_cookies();
    514387    fade_in = options.fade_in || 0;
     
    526399    var infos_window = jQuery(window).infos();
    527400    var infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre
    528     // general 
    529     var infos_content = jQuery("#content").infos(true);
    530     var infos_the_page = jQuery("#the_page").infos(true);
     401    // general
     402    var infos_content = jQuery("#content").infos({ absolute: true });
     403    var infos_the_page = jQuery("#the_page").infos({ absolute: true });
    531404    var nopano = false;
    532405    var llgbo_id = "#llgbo0";
     
    540413    var pictureSelType_user = eval("options." + user_status + "_type"); // limite
    541414    // taille
    542 
     415    var path_names = new Array();
     416    var img_finale = null;
     417    var mypanorama = null;
    543418
    544419    if (pictureSelType_user != "Autosize" && pictureSelType_user != "SelMaxi") {
     
    588463      }
    589464    Get_type_img();
    590     // auto_details
    591     // ==== limite affichage selection = select_type ====
    592     var path_names = new Array();
    593 
    594     Affiche_limite = function (pictureSelType_Maxi) {
    595       n = 0;
    596       var pt = new Array();
    597       path_names = new Array();
    598       jQuery("#derivativeSwitchBox a").css('visibility', 'hidden');
    599       // jQuery(".switchCheck").css('visibility', 'hidden');
    600       var maxi_display = false;
    601       jQuery("#derivativeSwitchBox a").each(function (i) {
    602         href_path = jQuery(this).attr("href");
    603         if (!href_path) {
    604           href_path = jQuery(this).html();
    605           return;
    606         }
    607         pt = href_path.replace(/(javascript|changeImgSrc)|[('):]/gi, "");
    608 
    609         patname = href_path.replace("javascript\:", "");
    610         if (typeof old_path == "undefined") old_path = patname;
    611         pt = pt.split(",");
    612         tsz = pt[pt.length - 1];
    613         if (!maxi_display)
    614           jQuery(this).css('visibility', 'visible');
    615         else {
    616           jQuery(this).next().next().remove();
    617           jQuery(this).next().remove();
    618           jQuery(this).remove();
    619         }
    620         // --- recherche limite ---
    621 
    622         if (!options.valide && (tsz == "Autosize" || tsz == "SelMaxi")) {
    623           jQuery(this).next().next().remove();
    624           jQuery(this).next().remove();
    625           jQuery(this).remove();
    626         } else {
    627           if (tsz == "Original" && (pictureSelType_Maxi != "Autosize" && pictureSelType_Maxi != "SelMaxi")) {
    628             maxi_display = true;
    629           } else if (tsz == pictureSelType_Maxi && (pictureSelType_Maxi != "Autosize" && pictureSelType_Maxi != "SelMaxi")) {
    630             maxi_display = true;
    631 
    632           } else if (tsz == "Autosize" || tsz == "SelMaxi") {
    633             patname = old_path.replace("')", "','" + tsz + "')");
    634           } else
    635             old_path = patname;
    636           path_names.push(patname);
    637         }
    638         // --- type en cours ---
    639         if (tsz.match(RegExp("^" + options.pictureDeriv, "gi"))) {
    640           us = n;
    641         }
    642         n++;
    643       });
    644     };
    645     // =============================================================
    646     // REPONSE ACTION
    647     // =============================================================
    648     theMainImage_st = false;
    649     jQuery("#reset").click(function () {
    650       location.reload();
    651     });
    652 
    653 
    654     // ===========================================================
    655     // REPONSE TRIGGER
    656     // ===========================================================
    657     jQuery('#ret_autosize').live('ON', function (e) {
    658       if (nu_img == "") nu_img = 8;
    659       jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
    660 
    661     });
    662 
    663     // ==========================================================
    664     jQuery("map area").mouseover(function (e) {
    665       try {
    666         nok = theImg.useMap;
    667         hok = this;
    668       }
    669       catch (r) {
    670 
    671       }
    672     });
    673 
    674     // ==================================
    675     // jQuery("#llgbo").trigger("ON");
    676     // ==================================
    677     jQuery(llgbo_id).live('ON', function (e) {
    678       n_id = this;
    679       infos_llgbo = jQuery(llgbo_id).infos();
    680       if (infos_llgbo.visible == false) return;
    681 
    682       marges_llgbo = 0;
    683       if (infos_llgbo.height > 0) {
    684         infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos();
    685         infos_llgboframe31 = jQuery(llgbo_id + "  div:first").infos();
    686         // =============================================
    687         ll2 = infos_llgboframe1.width; // llgboframe1 interieur
    688         ll1 = infos_llgboframe31.exterieur.width; // llgboframe31 avec border
    689         // width
    690         options.marges_llgbo = (ll1 - ll2);
    691         infos_llgboh2 = jQuery("#llgboh2").infos();
    692       }
    693     });
    694     // ==============================
    695     // jQuery("#mapPicture").trigger("ON");
    696     // ==============================
    697     jQuery("#mapPicture").live('ON', function (e) {
    698       p2 = jQuery("#infoSwitcher").infos();
    699     });
    700     // ==============================
    701     // jQuery("#map").trigger("ON");
    702     // ==============================
    703     jQuery("#map").live('ON', function (e) {
    704       p2 = jQuery("#map").infos();
    705     });
    706     // ===================================
    707     // jQuery("#theImage").trigger("ON");
    708     // ===================================
    709     jQuery("#imageInfos").live('on', function (e) {
    710       target = e.target.id;
    711     });
    712 
    713     // ===================================
    714     // jQuery("#theImage").trigger("ON");
    715     // ===================================
    716     jQuery("#theImage").live('ON', function (e) {
    717       target = e.target.id;
    718 
    719       id = this.id;
    720       Select_Image(); // +calcul
    721     });
    722 
    723 
    724 
    725 
    726     // =================================================================
    727     jQuery(document).live('gallyInterfaceReady', function (e) {
    728       i = jQuery(this).text();
    729       jQuery(this).trigger('ON');
    730     }
    731 
    732           );
    733 
    734465
    735466    /***************************************************************************
    736467    *
    737468    **************************************************************************/
    738     jQuery("#theImage").resize(function (e) {
    739       nu_img = 0;
    740     });
    741     jQuery("#menuSwitcher,#infoSwitcher").click(function (e) {
    742       options.set_sw = this.id;
    743       setTimeout(function () { div_resize(); }, 10);
    744       nu_img = 0;
    745     });
    746 
    747     div_resize = function (i) {
    748 
    749       jQuery("#theImage").trigger("resize");
    750       /*
    751       * if (jQuery("#theImage").width() != old_width) { setTimeout(function () {
    752       * div_resize() }, 10); }
    753       */
    754     };
    755     // ===========================================
    756     // jQuery("#theImageAndInfos").trigger("ON");
    757     // ===========================================
    758     jQuery("#theImageAndInfos").live('ON', function (e) {
    759       infos_theImageAndInfos = jQuery("#theImageAndInfos").infos();
    760       // setTimeout(function () { Autosize_resize(true) }, 100);
    761       nu_img = 0;
    762     }); // fin click #theImageAndInfos ON
    763 
    764 
    765     jQuery("#theImageAndInfos").resize(function (e) {
    766 
    767     });
    768 
    769 
    770     jQuery("#linkAutosize").click(function (e) {
    771       nu_img = 0;
    772     });
    773     // ==================================
    774     //
    775     // ===================================
    776     jQuery('#derivativeCheckedAutosize').click(function () {
    777       try {
    778         pathnames = jQuery(this).attr("href").split(":");
    779 
    780         // eval(pathnames[1]);
    781       } catch (e) {
    782         n = false;
    783       }
    784     }); // fin click derivativeCheckedAutosize
    785     // ====================================================
    786     if (typeof decode_href != 'function') {
    787       function decode_href(myObj) {
    788         hrefPath = jQuery(myObj).attr("href");
    789         if (hrefPath.indexOf("changeImgSrc") < 0) {
    790           pt = hrefPath;
    791         } else {
    792           pt = hrefPath.replace(/(javascript|phpWGOpenWindow|javascript|changeImgSrc)|[('):]/gi, "");
    793 
    794         }
    795         pt = pt.split(",");
    796         source = pt[0];
    797         if (hrefPath.indexOf("phpWGOpenWindow") < 0) {
    798           pictureDeriv = pt[1];
    799           pictureMap = pt[2];
    800           pictureSelType = pt[pt.length - 1];
    801         } else {
    802           pictureDeriv = options.pictureDeriv;
    803           pictureMap = options.pictureMap;
    804           pictureSelType = options.pictureSelType;
    805         }
    806         return { source: source,
    807           pictureDeriv: pictureDeriv,
    808           pictureMap: pictureMap,
    809           pictureSelType: pictureSelType
    810         };
    811       }
    812     }
    813 
    814     jQuery("#derivativeSwitchBox a").click(function (e) {
    815       Affiche_limite(pictureSelType_user);
    816       retour = decode_href(this);
    817       theImg = document.getElementById(theMainImage_id.replace("#", ""));
    818       if (theImg) {
    819         // options.pictureDeriv = retour.pictureDeriv;
    820         if (this.name) {
    821           options.pictureSelType = this.name;
    822           spans = jQuery("#derivativeChecked" + this.name).next();
    823           if (retour.pictureSelType != this.name)
    824             spans.attr("href", "javascript:" +
    825                         "ChangeImgSrc('" + retour.source + "," +
    826                         retour.pictureDeriv + "," +
    827                         retour.pictureMap + "," + options.COOKIE_PATH + "')");
    828         }
    829         options.pictureSelType = retour.pictureSelType;
    830         options.pictureDeriv = retour.pictureDeriv;
    831         options.pictureMap = retour.pictureDeriv;
    832         Save_cookies(options);
    833         setTimeout(function (i) {
    834           Autosize_resize(false, options);
    835         }, 2);
    836 
    837       }
    838     });
    839     // __________ fin click #derivativeSwitchBox a ____________
    840 
    841     jQuery("input").click(function () {
    842       if (this.name.match(RegExp("_enabled", "gi"))) {
    843         sel = "[name*=" + this.name + "]";
    844         obj = jQuery("tr" + sel);
    845 
    846         if (this.checked)
    847           obj.css({ backgroundColor: "green", color: "white" });
    848         else
    849           obj.css({ backgroundColor: "red", color: "white" });
    850         return;
    851       }
    852       return;
    853     });
    854 
    855 
    856     // ====================================
    857     Autosize_init = function (name, value) {
    858       img_defaut = { height: options.scaled_height, width: options.scaled_width };
    859       img_reelle = { height: options.theImageHeight, width: options.theImageWidth };
    860       img_init = { height: options.theImageHeight, width: options.theImageWidth };  // taille
    861       // initiale
    862 
    863       img_finale = img_init;
    864 
    865       useMap = infos_theMainImage.useMap; // #mapmedium
    866 
    867       useMap = options.pictureMap; // #mapxxx
    868       pictureDeriv = options.pictureDeriv; // picturederiv xxx
    869 
    870 
    871       old_img = options.imgSrc;
    872       old_window_height = options.windowHeight || jQuery(window).height();
    873       old_window_width = options.windowWidth || jQuery(window).width();
    874       old_img_h = options.imgHeight;
    875       old_img_w = options.imgWidth;
    876       if (infos_theMainImage.visible == true) {
    877         theImg = document.getElementById(theMainImage_id.replace("#", ""));
    878         theImg.useMap = useMap;
    879       }
    880 
    881 
    882     };
    883     // ____________________ Autosize_init _____________________
    884 
    885     /***************************************************************************
    886     * Autosize_resize
    887     **************************************************************************/
    888     Autosize_resize = function (force, parametres) {
    889 
    890       if (!force) {
    891         cookis = Get_cookies();
    892         if (cookis.pictureSelType != options.pictureSelType) {
    893           n = 0;
    894         }
    895       }
    896       nauto = Get_dimensions(true, options);
    897       if (nauto == "Wait") {
    898         setTimeout(function (force, parametres) { Autosize_resize(force, parametres); }, 100);
    899         return;
    900       }
    901       Save_cookies(options);
    902       if (!options.valide || !nauto || (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi")) {
    903         if (options.imageAutosize == true) {
    904           options.pictureSelType = options.pictureDeriv;
    905           Zone_image.image_init.width = jQuery(theImg).width();
    906           Zone_image.image_init.height = jQuery(theImg).height();
    907           set_cl("no");
    908           Set_llbgo(true);
    909           return;
    910         }
    911         // jQuery(theImg).width(Zone_image.image_init.width);
    912         jQuery(theImg).height(Zone_image.image_init.height);
    913         set_cl("no");
    914         Set_llbgo(true);
    915         return;
    916 
    917       }
    918       infos_theImage = jQuery(theImage_id).infos(true);
    919 
    920       if (typeof img_finale == "undefined") img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
    921       if (img_finale.width && (img_finale.width != Zone_image.image.width || img_finale.height != Zone_image.image.height)) {
    922         img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
    923       }
    924 
    925       // ======================================================
    926 
    927       affiche_debug({
    928 
    929         Debug1: Debug_info(1, "Cont:" + infos_theImage.width
    930     + " X " + infos_theImage.height
    931     + " IMG: " + img_finale.width
    932     + " X " + img_finale.height
    933     + " mgw : " + Zone_image.marges.width
    934     , "->")
    935       });
    936 
    937       if (Type_Img == "pamoorama") {// img_finale.width
    938         jQuery("#pamoorama").width(img_finale.width);
    939         jQuery("#pamoorama").height(img_finale.height);
    940 
    941 
    942         infos_pamoorama = jQuery("#pamoorama").infos({ absolute: true });
    943 
    944         Set_Pamoorama({ width: img_finale.width, height: img_finale.height });
    945         if (nopano)
    946           if (window.myPamoorama.options.autoscrollOnLoad) {
    947             window.myPamoorama.startAnimRight();
    948           }
    949 
    950       } else if (Type_Img == "panorama") {
    951         // jQuery("#pamoorama").width(img_finale.width);
    952         // jQuery("#pamoorama").height(img_finale.height);
    953 
    954 
    955 
    956         // jQuery("#theImage img.simple_panorama").panorama(asp_options);
    957       } else {
    958         if (options.imageAutosize == false)
    959           if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
    960             jQuery(theMainImage_id).height(Zone_image.image.height);
    961             r1 = infos_theImage.width / infos_theImage.height;
    962             jQuery(theMainImage_id).css("margin-top", options.marge_haute);
    963           } else {
    964             jQuery(theMainImage_id).width(Zone_image.image_init.width);
    965             jQuery(theMainImage_id).height(Zone_image.image_init.height);
    966           }
    967         if (Type_Img == "charlie" || Type_Img == "iframe") {
    968           init_w1 = Zone_image.image.width;
    969           init_h1 = Zone_image.image.height;
    970           if (pictureSelType_user != "Autosize" && pictureSelType_user != "SelMaxi") {
    971             init_w1 = Autosize_options.ideal_size_width;
    972             init_h1 = Autosize_options.ideal_size_height;
    973           }
    974           if (Type_Img == "charlie") {
    975             dp1 = jQuery("#charlie").offset();
    976             dp = jQuery("#" + the_mainImage_obj).offset();
    977             if (dp) {
    978               if (wpng == 0)
    979                 wpng = Math.abs(dp.left - dp1.left) * 2;
    980             }
    981             png_h = init_h1;
    982             w01 = init_w1 - wpng;
    983 
    984             jQuery("#" + "theImage").css({ padding: 0 });
    985             if (!png_h) {
    986               png_h = jQuery("#theMainImage").height();
    987               h01 = png_h;
    988             } else
    989               h01 = Math.ceil(w01 / Zone_image.image.rapport);
    990             // ==== Zone Affichage =====
    991             if (h01 > png_h) {
    992               h01 = png_h;
    993               w01 = Math.ceil(h01 * Zone_image.image.rapport);
    994             }
    995             jQuery("#theMainImage").height(png_h);
    996             jQuery("#theMainImage").width(w01 + wpng);
    997             jQuery("#theMainImage").css({ verticalAlign: "middle", align: "center", textAlign: "center", margin: "auto" });
    998 
    999             jQuery("#" + the_mainImage_obj).attr("width", w01);
    1000             jQuery("#" + the_mainImage_obj).attr("height", h01);
    1001 
    1002             jQuery("#theMainImage_emb").attr("width", w01); // firefox opera
    1003             jQuery("#theMainImage_emb").attr("height", h01);
    1004 
    1005             if (jQuery("#theMainImage_vid").length > 0) {
    1006               jQuery("#theMainImage_vid").attr("width", w01);
    1007               jQuery("#theMainImage_vid").attr("height", h01);
    1008             }
    1009             if (jQuery("video").length > 0) {
    1010               jQuery("video").attr("width", w01);
    1011               jQuery("video").attr("height", h01);
    1012             }
    1013             jQuery("#" + Type_Img).height(png_h);
    1014             jQuery("#" + Type_Img + " div").width(w01);
    1015             jQuery("#theImage").css({ height: "auto" });
    1016           } else {
    1017             jQuery("#theImage").css({ height: "auto" });
    1018             jQuery("#theMainImage").css({ width: "auto", height: "auto" });
    1019             jQuery("#" + Type_Img).attr("width", init_w1 - (infos_theMainImage.borderwidth.left + infos_theMainImage.borderwidth.right));
    1020             jQuery("#" + Type_Img).attr("height", init_h1 - (infos_theMainImage.borderwidth.top + infos_theMainImage.borderwidth.bottom));
    1021           }
    1022           jQuery("#" + Type_Img).show(fade_in);
    1023         }
    1024 
    1025 
    1026       }
    1027 
    1028       set_cl();
    1029       Set_llbgo(true);
    1030       return true;
    1031     };
    1032     // _________________Autosize ____________________________________
    1033 
    1034 
    1035     /***************************************************************************
    1036     * pamoorama
    1037     **************************************************************************/
    1038     jQuery('#pamoorama').live('ON', function (e) {
    1039       jQuery(jQuery('.debug').get(1)).trigger('ON');
    1040       Autosize_resize(true, options);
    1041       jQuery("#pamoorama").fadeTo(fade_in + 20, 1);
    1042     });
    1043 
    1044     // ===============================================
    1045     // jQuery("#theImage").trigger("Start_right");
    1046     // ===============================================
    1047     jQuery("#theImage").live('Start_right', function (e) {
    1048       if (typeof Zone_image == "undefined") return
    1049       test_w = window.myPamoorama.autoSlideFx.to;
    1050       test_w = window.myPamoorama.autoScrollFx.to;
    1051       nf = jQuery("#pamoorama_thumb").height();
    1052       jQuery("#pamoorama_thumb img").width(200);
    1053       jQuery("#pamoorama_thumb img").height(nf);
    1054       // 200=window.myPamoorama.imageWidth
    1055       // frame = Zone_image.container.width
    1056       nw = (200 * Zone_image.image.width) / window.myPamoorama.imageWidth;
    1057       jQuery("#pamoorama_frame").width(nw);
    1058     });
    1059     // ===============================================
    1060     // jQuery("#theImage").trigger("Start_left");
    1061     // ===============================================
    1062     jQuery("#theImage").live('Start_left', function (e) {
    1063       if (typeof Zone_image == "undefined") return
    1064       jQuery("#theImage").show(0);
    1065       window.myPamoorama.autoSlideFx.to = 0;
    1066       test_w = window.myPamoorama.autoSlideFx.to;
    1067       test_w = window.myPamoorama.autoScrollFx.to;
    1068       nf = jQuery("#pamoorama_thumb").height();
    1069       jQuery("#pamoorama_thumb img").width(200);
    1070       jQuery("#pamoorama_thumb img").height(nf);
    1071     });
    1072 
    1073     /***************************************************************************
    1074     * Wait_pamoorama
    1075     **************************************************************************/
    1076     Wait_pamoorama = function () {
    1077       if (Type_Img != "pamoorama") return;
    1078       tempo = 0;
    1079       Wait_pamoorama_st = false;
    1080       while (Wait_pamoorama_st == false) {
    1081         Wait_pamoorama_st = Wait_pamoorama_time();
    1082         jQuery.noop();
    1083       }
    1084       tempo = 0;
    1085       if (nopano) {
    1086         if (window.myPamoorama.options.autoscrollOnLoad) {
    1087           window.myPamoorama.startAnimRight();
    1088           jQuery.delay(100);
    1089         }
    1090       }
    1091     };
    1092     // __________________ Wait_pamoorama ______________________
    1093     jQuery(".pwg-icon-clock-minus, .pwg-icon-clock-plus").click(function (i) {
    1094 
    1095     }).mouseover(function (i) {
    1096 
    1097     });
    1098 
    1099     Wait_pamoorama_time = function () {
    1100       if (nopano == true) return true;
    1101       if (jQuery("#pamoorama").length) {
    1102         tempo = tempo + 1;
    1103         mypanorama = window.myPamoorama;
    1104         if (!mypanorama) {
    1105           if (tempo > 500) return true;
    1106           setTimeout("Wait_pamoorama_time()", 500);
    1107           return false;
    1108         }
    1109        /* if (mypanorama.skipInit == false) {
    1110           if (tempo > 500) return true;
    1111           setTimeout(function () {
    1112             Wait_pamoorama_time();
    1113           }, 500);
    1114           return false;
    1115         }*/
    1116        
    1117         // =============================================================
    1118         if(typeof mypanorama.imageHeight=="undefined"){
    1119           setTimeout(function () {
    1120             Wait_pamoorama_time();
    1121           }, 500);
    1122           return false;
    1123         }
    1124 
    1125         if (jQuery(".infos").length > 0) {
    1126           jQuery(".infos").empty();
    1127           jQuery(".infos").hide();
    1128         }
    1129 
    1130         nopano = true;
    1131 
    1132         Zone_image = { image_init: { width: mypanorama.imageWidth,
    1133           height: mypanorama.imageHeight
    1134         }
    1135         };
    1136         jQuery("#pamoorama").trigger("ON");
    1137         return true;
    1138 
    1139       }
    1140     };
    1141     // __________________ Wait_pamoorama time______________________
    1142 
    1143     /***************************************************************************
    1144     *
    1145     **************************************************************************/
    1146     Wait_Affichage = function () {
    1147       Wait_Affichage_st = false;
    1148       while (Wait_Affichage_st == false) {
    1149         jQuery.noop();
    1150         Wait_Affichage_st = Wait_Affichage_time();
    1151       }
    1152     };
    1153     // __________________ Wait_Affichage ______________________
    1154 
    1155 
    1156     Wait_Affichage_time = function () {
    1157       // if (nu_img > 1) return;
    1158       if (typeof stb != "undefined")
    1159         stb.stop().fadeTo(3500, 0);
    1160       if (typeof theMainImage_id == "undefined") return true;
    1161 
    1162       if (theMainImage_id.selector) {
    1163         theMainImage_id = theMainImage_id.selector;
    1164       }
    1165       if (theMainImage_id == null) return;
    1166 
    1167       if (jQuery(theMainImage_id).length == 0) {
    1168         if (jQuery("#pamoorama_inner").length > 0) {
    1169           return true;
    1170         }
    1171         // === attente Image chargée ===
    1172         if (tempo > 100) return true;
    1173         tempo++;
    1174         setTimeout("Wait_Affichage_time()", 500);
    1175         return false;
    1176 
    1177       } else {
    1178 
    1179         img_h = jQuery(theMainImage_id).height();
    1180         img_w = jQuery(theMainImage_id).width();
    1181 
    1182         if (typeof infos_theImage == "undefined") return;
    1183         jQuery("#ret_autosize").trigger('ON', {
    1184           width: img_w,
    1185           height: img_h,
    1186           theImage: theMainImage_id,
    1187           img_src: infos_theMainImage.src,
    1188           window_height: infos_theImage.height,
    1189           window_width: infos_theImage.width
    1190         });
    1191       }
    1192       return true;
    1193     };
    1194     // ______________ Wait_affichage ______
    1195 
    1196 
    1197     /***************************************************************************
    1198     *
    1199     **************************************************************************/
    1200     init_img = function (theImg) {
    1201       if (theImg.complete == false) {
    1202         return;
    1203       }
    1204       name_src = theImg.src;
    1205       stx = name_src.match(RegExp(Zone_image.src, "gi"));
    1206       if (stx == null) {
    1207         return false;
    1208       }
    1209       img_init = { width: jQuery(theImg).width(), height: jQuery(theImg).height() };
    1210 
    1211       if (typeof theImg.naturalWidth != "undefined")
    1212         img_init.width = theImg.naturalWidth;
    1213       if (typeof theImg.naturalHeight != "undefined")
    1214         img_init.height = theImg.naturalHeight;
    1215       img_init.rapport = img_init.width / img_init.height;
    1216       if (typeof Zone_image == "undefined") Zone_image = { image: {} };
    1217       if (typeof Zone_image.image == "undefined") Zone_image.image = { height: Zone_image.image_init.height, width: Zone_image.image_init.width };
    1218       // theImg.height = img_init.height;
    1219       // theImg.width = img_init.width;
    1220 
    1221       Zone_image.image_init = { height: img_init.height, width: img_init.width, rapport: img_init.rapport };
    1222       Zone_image.zoom = Zone_image.image_init.height / img_init.height;
    1223 
    1224       if (typeof Zone_image.src == "undefined") {
    1225         Zone_image.src = name_src;
    1226         return false;
    1227       }
    1228       stx = name_src.match(RegExp(Zone_image.src, "gi"));
    1229       return stx;
    1230     };
    1231     // ___________ init_img _______
    1232 
    1233 
    1234 
    1235     // ===========================================
    1236     //
    1237     // ===========================================
    1238     Set_Map = function (nds) {
    1239       p0 = jQuery("#map").offset();
    1240       if (!p0) return;
    1241       infos_mapPicture = jQuery("#mapPicture").infos({ absolute: true });
    1242       infos_theImage = jQuery("#theImage").infos({ absolute: true });
    1243       jQuery("#map").removeAttr("height");
    1244       jQuery("#map").removeAttr("width");
    1245       jQuery("#map").width(infos_theImage.width - (infos_mapPicture.width));
    1246       jQuery("#map").height(jQuery(window).height() - infos_theImage.top - infos_theImage.general.marges.height);
    1247       return true;
    1248     };
    1249 
    1250     jQuery("map [name='#Autosize'] area").mouseover(function (e) {
    1251       return;
    1252     });
    1253     // ___ Set_Map ___
    1254 
    1255     // =====================================
    1256     //
    1257     // =====================================
    1258     Get_Maxi = function (Maxi_image) {
    1259       var pt = options.liste_type;
    1260       if (pt.length > 0) {
    1261         tw = Maxi_image.width;  // valeur maxi
    1262         th = Maxi_image.height;  // valeur maxi
    1263         n = 0;
    1264         maxi_size = { w: Maxi_image.width, h: Maxi_image.height, idx: -1 };
    1265         mini_size = { w: tw, h: th, idx: 0 };
    1266         size_derive = { w: 0, h: 0 };
    1267         size_encours = { w: tw, h: th };
    1268         // =================================
    1269         jQuery(pt).each(function (i) {
    1270           vn = this;
    1271           v_pictureDeriv = vn[0]; v_imgSrc = vn[1]; v_width = parseInt(vn[2]); v_height = parseInt(vn[3]);
    1272           size_derive = { w: v_width, h: v_height };
    1273           if (v_pictureDeriv == options.pictureSelType) {
    1274             maxi_size = size_derive;
    1275             maxi_size.idx = n;
    1276             return false;
    1277           }
    1278 
    1279           if (v_pictureDeriv != "square" && v_pictureDeriv != "thumb" && v_pictureDeriv != "SelMaxi" && v_pictureDeriv != "Autosize") {
    1280             if (size_derive.h > size_encours.h) {
    1281               if (maxi_size.idx < 0) {
    1282                 maxi_size = size_derive;
    1283                 maxi_size.idx = n;
    1284                 if (options.pictureSelType == "SelMaxi" || options.pictureSelType == "Autosize")
    1285                   return false;
    1286               }
    1287             }
    1288             if (size_derive.h < size_encours.h && size_derive.h > 10) {
    1289               mini_size = size_derive;
    1290               mini_size.idx = n;
    1291             }
    1292           }
    1293           n++;
    1294         });
    1295 
    1296 
    1297 
    1298 
    1299         n = maxi_size.idx;
    1300         if (n < 0) {
    1301           n = mini_size.idx;
    1302         }
    1303         if (options.pictureSelType.match(RegExp("SelMaxi", "gi"))) {
    1304           n = mini_size.idx;
    1305 
    1306         }
    1307         if (options.pictureSelType.match(RegExp("Autosize", "gi"))) {
    1308 
    1309         }
    1310 
    1311         pictureDeriv = pt[n][0];
    1312         last_id = pt[n][0];
    1313         jQuery(".switchCheck").each(function (i) {
    1314 
    1315           if (!this.id.match(RegExp("Original", "gi"))) {
    1316             if (this.id.match(RegExp("SelMaxi", "gi"))) return false;
    1317             last_id = this.id.replace("derivativeChecked", "");
    1318           }
    1319           if (last_id == pictureDeriv)
    1320             return false;
    1321         });
    1322 
    1323         options.pictureDeriv = last_id;
    1324 
    1325         return { url: pt[n][1], pictureDeriv: last_id, pictureMap: last_id, width: pt[n][2], height: pt[n][3] };
    1326       }
    1327       return { imgSrc: "", pictureDeriv: "", width: "", height: "" };
    1328     };
    1329     // _______________ Get_Maxi ______
    1330 
    1331     /***********************
    1332     * Selection de l'image
    1333     ************************/
    1334     Select_Image = function () {
    1335       var pt = options.liste_type;
    1336       if (pt.length > 0) {
    1337         // ===== calcul Image ===
    1338         if (typeof imageInfos_id == "undefined") return;
    1339         if (Calcul_Image() == "Wait") {   // image en cours           
    1340           return "Wait";
    1341         }
    1342         //==================================================
    1343         options.theImageMargeZone = Zone_image.marges;
    1344         if (Type_Img != 'charlie') {
    1345           IMg = Get_Maxi(Zone_image.image);
    1346           imgSrc = IMg.url;
    1347           if (options.imgSrc.match(RegExp(imgSrc, "gi")))
    1348             options.imgSrc = imgSrc;
    1349           // dimension image
    1350           img_width = IMg.width;
    1351           img_height = IMg.height;
    1352           Zone_image.image_init = { height: IMg.height,
    1353             width: IMg.width,
    1354             rapport: IMg.width / IMg.height
    1355           };
    1356           if (typeof Zone_image.image == "undefined")
    1357             Zone_image.image = { height: IMg.height,
    1358               width: IMg.width,
    1359               rapport: IMg.width / IMg.height
    1360             };
    1361         } else {
    1362           return true;
    1363         }
    1364         Zone_image.zoom = Zone_image.image.height / Zone_image.image_init.height;
    1365         if (typeof Zone_image.src == "undefined")
    1366           Zone_image.src = imgSrc;
    1367         if (typeof Zone_image.name == "undefined")
    1368           Zone_image.name = " ";
    1369         if (typeof Zone_image.path == "undefined")
    1370           Zone_image.path = " ";
    1371 
    1372         imgSrcS = imgSrc.split('/');
    1373         imgSrcS = imgSrcS[imgSrcS.length - 1];
    1374         if (!theImg.src) theImg.src = imgSrc;
    1375         identique = theImg.src.match(RegExp(imgSrc, "gi"));
    1376         if (identique)
    1377           identique = theImg.src.match(RegExp("loadajax", "gi"));
    1378         if (identique) return true;
    1379         href_path = get_href(IMg.pictureDeriv);
    1380         if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
    1381           spans = jQuery("#derivativeChecked" + options.pictureSelType).next();
    1382           spans.attr("href", "javascript:" + href_path);
    1383         }
    1384         theImg = document.getElementById(theMainImage_id.replace("#", ""));
    1385         if ((theImg == null) || theImg.tagName != "IMG") {
    1386           imgSrc_i = jQuery(theImg).css("backgroundImage");
    1387           imgSrc_j = jQuery(theImg).css("background-image");
    1388           return true;
    1389         } else {
    1390           eval(href_path);
    1391 
    1392         }
    1393         theImg.useMap = "#map" + IMg.pictureMap;
    1394         return true;
    1395         theImg = document.getElementById(theMainImage_id.replace("#", ""));
    1396         if (init_img(theImg)) {
    1397           return true;
    1398         }
    1399         return false;
    1400       } else {
    1401         return false;
    1402       }
    1403 
    1404     };  // _______________ Select_Image ______
    1405 
    1406469    get_href = function (NewpictureDeriv) {
     470      if (path_names.length == 0) Affiche_limite(pictureSelType_user);
    1407471      ref = path_names[0];
    1408472      for (i = 0; i < path_names.length; i++) {
     
    1427491
    1428492    /***************************************************************************
    1429     * correction pamoorama
     493    *
    1430494    **************************************************************************/
    1431     Set_Pamoorama = function (Format) {
    1432       myPamoorama = window.myPamoorama;
    1433       if (Type_Img == "pamoorama") {
    1434         if (!nopano) {
    1435           theMainImage_Id = "#pamoorama";
    1436           nopano = false;
    1437           Wait_pamoorama();
    1438           infos_theMainImage = jQuery(theMainImage_Id).infos();
    1439         }
    1440         if (typeof myPamoorama == "undefined") {
    1441           return;
    1442         }
    1443         // =========================================================
    1444         if (!nopano) {
    1445           nopano = false;
    1446           Wait_pamoorama();
    1447           infos_theMainImage = jQuery(theMainImage_Id).infos();
    1448         }
    1449 
    1450 
    1451         infos_pamoorama_outter = jQuery("#pamoorama_outter").infos({ absolute: true });
    1452         infos_pamoorama_inner = jQuery("#pamoorama_inner").infos({ absolute: true });
    1453         infos_pamoorama_frame = jQuery("#pamoorama_frame").infos({ absolute: true });
    1454         infos_frame = jQuery(myPamoorama.frame).infos({ absolute: true });
    1455 
    1456 
    1457         // ====================================================
    1458         marges_w = infos_pamoorama.general.marges.width;
    1459         marges_h = infos_pamoorama.general.marges.height;
    1460 
    1461         jQuery("#pamoorama_footer").css({
    1462           width: Format.width + "px"
    1463         });
    1464         infos_pamoorama_footer = jQuery("#pamoorama_footer").infos();
    1465         marges_h += infos_pamoorama_footer.general.height;
    1466         outter_height = Format.height;
    1467 
    1468         Zoom_pano = (Format.height - marges_h) / Zone_image.image_init.height;
    1469         new_image = { height: Math.ceil(Zone_image.image_init.height * Zoom_pano),
    1470           width: Math.ceil(Zone_image.image_init.width * Zoom_pano)
    1471         };
    1472 
    1473         jQuery("#pamoorama_inner").css({
    1474           width: new_image.width + "px", height: new_image.height + "px", "background-size": "100%"
    1475         });
    1476         // ---------- test largeur image
    1477         new_width = Format.width; // -(options.marge_right + options.marge_left);
    1478 
    1479         if (new_width > new_image.width) {
    1480           new_width = new_image.width;
    1481           jQuery("#pamoorama_outter").css({
    1482 
    1483             align: "center",
    1484             margin: "0"
    1485           });
    1486         }
    1487         outter_width = new_width;
    1488 
    1489         jQuery("#pamoorama_outter").css({
    1490           align: 'center',
    1491           margin: 'auto',
    1492           width: outter_width + "px",
    1493           height: Format.height - marges_h + "px"
    1494         });
    1495         // ============= Mise à l'echelle ==================
    1496         window.myPamoorama.options.width = Math.ceil(Format.width);
    1497         // ==================================================================
    1498         new_max_left = new_image.width - outter_width;
    1499         if (!window.myPamoorama.outter) return;
    1500         window.myPamoorama.outter.scrollTo(new_max_left, 0);
    1501 
    1502         if (typeof window.myPamoorama.autoScrollFx != "undefined") window.myPamoorama.autoScrollFx.to = new Array(new_max_left, 0);
    1503         window.myPamoorama.ratio = Math.ceil(new_image.width / 200);
    1504         window.myPamoorama.imageWidth = new_image.width;
    1505         window.myPamoorama.imageHeight = new_image.height;
    1506         nf = jQuery("#pamoorama_thumb").height();
    1507         jQuery("#pamoorama_thumb img").width(200);
    1508         jQuery("#pamoorama_thumb img").height(nf);
    1509 
    1510         jQuery("#pamoorama_thumb").css({
    1511           /* position: "absolute", */
    1512           left: (Format.width - 215) + "px"
    1513 
    1514         });
    1515         jQuery("#pamoorama_thumb img").css({
    1516 
    1517         });
    1518         // 200=window.myPamoorama.width
    1519         // frame = Zone_image.container.width
    1520 
    1521         nw = (window.myPamoorama.image.width * Format.width) / window.myPamoorama.imageWidth;
    1522         jQuery("#pamoorama_frame").width(nw);
    1523 
    1524 
    1525       } // 
    1526     }; // Set_Pamoorama
    1527 
    1528     /** ****************************************************** */
    1529 
    1530     Toggle_bp = function () {
    1531       options.cl_visible = !options.cl_visible;
    1532       Autosize_resize();
    1533       Wait_Affichage();
    1534 
    1535     };
    1536 
    1537     // ====================================
    1538     //
    1539     // ====================================
    1540     Calcul_Image = function () {
    1541 
    1542       /** ************************************* */
    1543       if (typeof imageInfos_id == "undefined") return;
    1544       infos_imageInfos = jQuery(imageInfos_id).infos({ absolute: true });             // information
    1545       infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });         // Image
    1546       // commentContent
    1547       // copyright
    1548 
    1549       if (options.slideshow) {
    1550 
    1551 
    1552       } else {
    1553 
    1554       }
    1555       if (typeof Zone_image.name == "undefined") {
    1556         var names = Array();
    1557         names = options.imgSrc.toString().split("/");
    1558         names = names[names.length - 1].split("-");
    1559         names = names[0].split(".");
    1560         Zone_image.name = names[0];
    1561       }
    1562 
    1563       if (Type_Img == "img") {
    1564         Zone_image.src = jQuery(theMainImage_id).attr("src");
    1565         if (typeof Zone_image.src != "undefined") {
    1566           if (Zone_image.src.match(RegExp(Zone_image.name, "gi"))) {
    1567             Zone_image.path = infos_theMainImage.src;
    1568           } else
    1569             return "Wait";
    1570         } else {
    1571           Zone_image.src = "";
    1572           Zone_image.path = "";
    1573         }
    1574       } else {
    1575         Zone_image.src = jQuery(theMainImage_id).attr("src");
    1576         Zone_image.path = infos_theMainImage.src;
    1577       }
    1578       pos_top = options.pos_top;
    1579       // pos_top = infos_theImage.top;
    1580 
    1581       pos = jQuery(theImage_id).offset();
    1582       infos_theImage = jQuery(theImage_id).infos(true);   // container
    1583       infos_window = jQuery(window).infos(true);   // window
    1584       w = infos_theImage.general.marges.width;
    1585 
    1586       container = {
    1587         height: infos_window.height - options.theImageTop,
    1588         width: infos_window.width - options.theImageLeft - options.theImageRight
    1589       };
    1590       marge_left = options.marge_left | 0;
    1591       marge_right = options.marge_right | 0;
    1592       marge_top = options.marge_top | 0;
    1593 
    1594 
    1595       // ==========================================================
    1596       if (test_theme("stripped")) {
    1597         infos_the_page.margin.left = 20;  // taille fleche
    1598         infos_the_page.margin.right = 20;
    1599 
    1600       } else if (test_theme("kardon")) {
    1601 
    1602       } else if (test_theme("elegant")) {
    1603 
    1604         if (infos_imageInfos.visible == true) {
    1605           // marge_right += infos_imageInfos.general.width; ;
    1606 
    1607         } else {
    1608           marge_right += 0;
    1609 
    1610         }
    1611         marge_right += 1;
    1612         marge_left += 1;
    1613 
    1614       } else if (test_theme("stripped")) {
    1615 
    1616       } else if (test_theme("simple")) {
    1617         infos_menubar = jQuery("#menubar").infos({ absolute: true });
    1618         infos_imageInfoBar = jQuery("#imageInfoBar").infos({ absolute: true });
    1619 
    1620         if (infos_imageInfoBar.left - infos_theImage.left - 2 > 0) {
    1621           jQuery("#theImage").width(infos_imageInfoBar.left - infos_theImage.left - 2);
    1622         }
    1623         marge_left += 0;
    1624         marge_right += 0;
    1625 
    1626       } else if (test_theme("OS")) {
    1627 
    1628       } else if (test_theme("pur")) {
    1629         marge_right += 0;
    1630         // marge_right += 25;
    1631       } else if (test_theme("mont")) {
    1632         marge_right += 0;
    1633 
    1634         // marge_right += 25;
    1635 
    1636 
    1637       } else {
    1638 
    1639 
    1640 
    1641       }
    1642 
    1643 
    1644       retrait_img = {};
    1645       // ========== Format Image ==============
    1646       retrait_img.height = Math.ceil(options.marges_llgbo || 0)
    1647       + Math.ceil(infos_theMainImage.general.marges.height) +
    1648       +Math.ceil(options.marges_llgbo || 0);
    1649       retrait_img.height += 2;
    1650 
    1651 
    1652       // ===============================================================
    1653       retrait_img.width = Math.ceil(infos_theMainImage.general.marges.width); // borderwidth+padding
    1654       retrait_img.width = Math.ceil(infos_theImage.general.marges.width); // borderwidth+padding
    1655       retrait_img.width += Math.ceil(options.marges_llgbo || 0);
    1656       retrait_img.width += 2;
    1657       if (!options.check_desc_v)
    1658         options.marge_bottom_2 = 0;
    1659 
    1660       marge_bottom = options.marge_bottom_2 + options.marge_bottom;
    1661       // ================== Limite Format Image =====================
    1662       container.height_interne = container.height - marge_top - marge_bottom;
    1663       container.width_interne = container.width - marge_left - marge_right;
    1664 
    1665       container.height_interne = Math.max(
    1666                   container.height_interne,
    1667                   Math.ceil(options.mini_height) + retrait_img.height);
    1668       container.width_interne = Math.max(container.width_interne,
    1669                   Math.ceil(options.mini_width) + retrait_img.width);
    1670       image_max = {
    1671         height: (container.height_interne - retrait_img.height),
    1672         width: (container.width_interne - retrait_img.width)
    1673       };
    1674       // =========================
    1675       // test débordement
    1676       // =========================
    1677       height_theMainImage = Math.ceil(image_max.height);
    1678       width_theMainImage = Math.ceil(image_max.width);
    1679 
    1680       if (typeof Zone_image.image_init.rapport == "undefined") {
    1681         Zone_image.image_init.rapport = options.ratio;
    1682       }
    1683       if (Type_Img == "charlie") {
    1684         width_theMainImage = height_theMainImage * options.ratio;
    1685         Zone_image.image_init.rapport = options.ratio;
    1686 
    1687       } else if (Type_Img == "pamoorama") {
    1688         if (height_theMainImage > container.height_interne) {
    1689           n = options.pictureSelType;
    1690         }
    1691       } else {
    1692 
    1693         height_theMainImage = Math.ceil(width_theMainImage / options.ratio);
    1694 
    1695 
    1696 
    1697         if (height_theMainImage > container.height_interne) {
    1698           image_max.height = container.height_interne;
    1699           image_max.width = image_max.height * Zone_image.image_init.rapport;
    1700           width_theMainImage = Math.ceil(image_max.width);
    1701           height_theMainImage = Math.ceil(image_max.height);
    1702         }
    1703         if (width_theMainImage > container.width_interne) {
    1704           image_max.width = container.width_interne;
    1705           image_max.height = image_max.width / Zone_image.image_init.rapport;
    1706           width_theMainImage = Math.ceil(image_max.width);
    1707           height_theMainImage = Math.ceil(image_max.height);
    1708 
    1709         } else if (width_theMainImage > container.width) {
    1710 
    1711         } else {
    1712 
    1713         }
    1714       }
    1715       // ======== Initilisation Zone_image ===============
    1716       Zone_image.image = {
    1717         width: width_theMainImage,
    1718         height: height_theMainImage,
    1719         rapport: width_theMainImage / height_theMainImage
    1720       };
    1721       Zone_image.marges = { width: marge_left + marge_right + retrait_img.width,
    1722         height: marge_top + marge_bottom + retrait_img.height
    1723       };
    1724       return true;
    1725     };
    1726 
    1727     /***************************************************************************
    1728     * Calcul les dimensions.
    1729     **************************************************************************/
    1730     Get_dimensions = function (force, parametres) {
    1731       new_img = jQuery(theMainImage_id).infos({ absolute: true });
    1732       new_dim = jQuery(theImage_id).infos({ absolute: true });
    1733       new_win = jQuery(window).infos({ absolute: true }); // avec ascenseur
    1734       options.theImageTop = new_dim.top;
    1735       options.theImageLeft = new_dim.left;
    1736       options.theImageRight = (new_win.width - new_dim.right);
    1737       options.marge_bottom_2 = Math.ceil(new_dim.out.bottom - new_img.out.bottom);
    1738       options.marge_top_2 = options.marge_top_2 | 0;
    1739       new_dim.out.bottom = new_win.height - options.marge_bottom_2;
    1740       options.theImageBottom = new_win.height - new_dim.out.bottom;
    1741       if (options.slideshow) {
    1742         options.marge_top = 0;
    1743       } else {
    1744         options.marge_top_2 = Math.ceil(new_img.top - new_dim.top) + options.marge_top;
    1745       }
    1746 
    1747       if (options.theImageBottom_2 < 0) {
    1748         options.theImageBottom_2 = 0;
    1749       }
    1750 
    1751       options.theImageWidth = new_win.width - options.theImageLeft - options.theImageRight;
    1752       options.theImageHeight = new_win.height - options.marge_top - options.theImageBottom - options.theImageTop;
    1753 
    1754       if (Type_Img != "map" && Type_Img != "iframe")
    1755         if (Select_Image() == "Wait") {
    1756           return "Wait";
    1757         }
    1758       useMap = options.pictureSelType;
    1759       // =================================================================
    1760       switch (Type_Img) {
    1761         case "map":
    1762           if (Set_Map(true)) return false;
    1763           break;
    1764         case "panorama":
    1765           if (!theMainImage_id) {
    1766 
    1767           }
    1768           infos_theImage = jQuery(theMainImage_id).infos();
    1769           infos_the_page = jQuery("#the_page").infos();
    1770           if (typeof img_finale == "undefined") img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
    1771 
    1772           img_finale.height = infos_theImage.height;
    1773           break;
    1774         case "img":
    1775           break;
    1776         case "img_autre":
    1777           if (!theMainImage_id) {
    1778             if (DEBUG_autosize.match("true", "gi")) alert("The_MainImage=null");
    1779             return;
    1780 
    1781           }
    1782 
    1783           infos_the_page = jQuery("#the_page").infos();
    1784 
    1785 
    1786           break;
    1787         case "embed":
    1788           //
    1789           if (infos_theMainImage.width == 0)
    1790             infos_theMainImage = jQuery("#thePicturePage").infos();
    1791           if (infos_theMainImage.width == 0)
    1792             infos_theMainImage = jQuery("#the_page").infos();
    1793           iph1 = jQuery("#theImage div").infos();
    1794           break;
    1795         case "charlie":
    1796           Zone_image.zoom = 1;
    1797           Zone_image.image.width = options.theImageWidth;
    1798           Zone_image.image.height = options.theImageHeight;
    1799           break;
    1800         case "iframe":
    1801           wpng = 0;
    1802           Zone_image.image.width = options.theImageWidth;
    1803           Zone_image.image.height = options.theImageHeight;
    1804           Zone_image.zoom = 1;
    1805           break;
    1806         case "pamoorama":
    1807           Wait_pamoorama();
    1808           break;
    1809       }
    1810 
    1811 
    1812 
    1813       // =================================================
    1814       if (Zone_image.image.height < options.mini_height2) {
    1815         Zone_image.image.height = parseInt(options.mini_height2);
    1816         Zone_image.image.width = Math.ceil(Zone_image.image.height * Zone_image.image_init.rapport);
    1817       }
    1818       if (Zone_image.image.width < options.mini_width2) {
    1819         Zone_image.image.width = parseInt(options.mini_width2);
    1820         Zone_image.image.height = Math.ceil(Zone_image.image.width / Zone_image.image_init.rapport);
    1821       }
    1822       // ==================================================
    1823       // ImageWidthidth largeur à atteindre
    1824       // Calcul du rapport d'agrandissement
    1825 
    1826       echelle_max = parseFloat(options.echelle_max, '3');
    1827       if (Zone_image.zoom > echelle_max) {
    1828         Zone_image.zoom = echelle_max;
    1829         Zone_image.image.width = parseInt(Zone_image.image_init.width * Zone_image.zoom);
    1830         if (Zone_image.image_init.rapport > 0)
    1831           Zone_image.image.height = parseInt(Zone_image.image_init.width / Zone_image.image_init.rapport);
    1832       }
    1833       if (Type_Img != "pamoorama") {
    1834         mxi = Math.ceil(Zone_image.image.height + Zone_image.marges.height);
    1835         Zone_image.container.height = Math.max(Zone_image.container.height, mxi);
    1836       } else {
    1837 
    1838 
    1839       }
    1840       img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
    1841 
    1842       return true;
    1843     };
    1844     // ________________ Get_dimensions ___________________
    1845 
    1846 
    1847     /***************************************************************************
    1848     * init_gen
    1849     **************************************************************************/
    1850     init_gen = function (e) {
    1851       theImg = document.getElementById(theMainImage_id.replace("#", ""));
    1852       // ==================================================
    1853       marges_llgbo = 0;
    1854       options.marges_llgbo = 0;
    1855       if (jQuery(llgbo_id).length > 0) {
    1856         infos_llgbo = jQuery(llgbo_id).infos(true);
    1857         if (infos_llgbo.visible == true) {
    1858           if (infos_llgbo.height > 0) {
    1859             infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos();
    1860             infos_llgboframe31 = jQuery(llgbo_id + "  div:first").infos();
    1861             // =============================================
    1862             ll2 = infos_llgboframe1.width; // llgboframe1
    1863             ll1 = infos_llgboframe31.general.width; // llgboframe31
    1864             options.marges_llgbo = (ll1 - ll2);
    1865             infos_llgboh2 = jQuery("#llgboh2").infos();
    1866           }
    1867         }
    1868 
    1869         marges_llgbo = options.marges_llgbo;
    1870       }
    1871 
    1872       // ========= Récupération des informations =============
    1873 
    1874       options.marge_top = 0;
    1875       pAll = jQuery(llgbo_id).absoluteAll({ absolute: true });
    1876       infos_llgbo.top = pAll.Top;
    1877       infos_llgbo.bottom = pAll.Bottom;
    1878       pAll = jQuery(theMainImage_id).absoluteAll({ absolute: true });
    1879       pos_top = pAll.Top; ;
    1880       pos_bottom = pAll.Bottom; ;
    1881       if (infos_llgbo.top > 0) {
    1882         pos_top = infos_llgbo.top;
    1883         options.marge_top = infos_theMainImage.top - infos_theImage.top;
    1884         options.marge_bottom = Math.ceil(options.marge_basse + options.marge_top);
    1885 
    1886       } else {
    1887         pos_top = infos_theImageAndInfos.top;
    1888         options.marge_bottom = Math.ceil(options.marge_basse);
    1889       }
    1890 
    1891       options.pos_top = pos_top;
    1892       new_img = jQuery(theMainImage_id).infos({ absolute: true });
    1893       new_dim = jQuery(theImage_id).infos({ absolute: true });
    1894       options.marge_top += Math.ceil(new_img.top - new_dim.top);
    1895 
    1896 
    1897       options.marge_left = infos_theImage.general.marges.left + Math.ceil(options.marge_gauche);
    1898       options.marge_right = infos_theImage.general.marges.right + Math.ceil(options.marge_droite);
    1899       options.marge_top += infos_theImage.general.marges.top +
    1900                            infos_content.general.marges.top +
    1901                            Math.ceil(options.marge_haute);
    1902 
    1903 
    1904       if (options.pictureDeriv == null)
    1905         options.first = true;
    1906       else
    1907         options.first = false;
    1908       // =================== Gestion liste photos size
    1909       us = 0;
    1910       if (!options.theMainImageWidth) options.theMainImageWidth = options.scaledWidth;
    1911       if (!options.theMainImageHeight) options.theMainImageHeight = options.scaledHeight;
    1912 
    1913       if (options.first) {
    1914         if (options.pictureDeriv) {
    1915 
    1916           pictureSelType = options.pictureSelType;
    1917           options.pictureMap = options.pictureDeriv;
    1918 
    1919         } else {
    1920           IMg = Get_Maxi(Zone_image.image);
    1921           options.pictureDeriv = IMg.pictureDeriv;
    1922           imgSrc = IMg.url;
    1923           width = IMg.width;
    1924           height = IMg.height;
    1925           options.pictureDeriv = IMg.pictureDeriv;
    1926           options.pictureMap = IMg.pictureMap;
    1927         }
    1928       }
    1929       if (pictureSelType_user != options.pictureSelType) {
    1930         /*
    1931         * user_status = options.user_status; pictureSelType_user =
    1932         * eval("options." + user_status + "_type"); //limite taille
    1933         */
    1934         pictureDeriv_user = options.pictureDeriv;
    1935         options.pictureDeriv_user = pictureDeriv_user;
    1936         pictureSelType = options.pictureSelType;
    1937       }
    1938       Affiche_limite(pictureSelType_user);
    1939 
    1940       // =================== 2==================================
     495    Ajuste_Liens = function () {
     496      // =================== 2 ============================
    1941497      sav_p = options.pictureSelType;
    1942498      options.pictureSelType = "SelMaxi";
     
    1968524        jQuery('#derivativeChecked' + options.pictureDeriv).css('visibility', 'visible');
    1969525      }
    1970       pictureDeriv = options.pictureDeriv;
     526      return options.pictureDeriv;
     527    };
     528
     529
     530    /***************************************************************************
     531    *
     532    **************************************************************************/
     533    jQuery("#derivativeSwitchBox a").click(function (e) {
     534      Affiche_limite(pictureSelType_user);
     535      retour = decode_href(this);
     536      theImg = document.getElementById(theMainImage_id.replace("#", ""));
     537      if (theImg) {
     538        // options.pictureDeriv = retour.pictureDeriv;
     539        if (this.name) {
     540          options.pictureSelType = this.name;
     541          spans = jQuery("#derivativeChecked" + this.name).next();
     542          if (retour.pictureSelType != this.name)
     543            spans.attr("href", "javascript:" +
     544  "ChangeImgSrc('" + retour.source + "," +
     545  retour.pictureDeriv + "," +
     546  retour.pictureMap + "," + options.COOKIE_PATH + "')");
     547        }
     548        options.pictureSelType = retour.pictureSelType;
     549        options.pictureDeriv = retour.pictureDeriv;
     550        options.pictureMap = retour.pictureDeriv;
     551        Save_cookies(options);
     552        if (typeof Autosize_resize == "function")
     553          setTimeout(function (i) {
     554            Autosize_resize(false, options);
     555          }, 2);
     556
     557      }
     558    });
     559    // __________ fin click #derivativeSwitchBox a ____________
     560    Affiche_limite = function (pictureSelType_Maxi) {
     561      n = 0;
     562      var pt = new Array();
     563      path_names = new Array();
     564      jQuery("#derivativeSwitchBox a").css('visibility', 'hidden');
     565      // jQuery(".switchCheck").css('visibility', 'hidden');
     566      var maxi_display = false;
     567      jQuery("#derivativeSwitchBox a").each(function (i) {
     568        href_path = jQuery(this).attr("href");
     569        if (!href_path) {
     570          href_path = jQuery(this).html();
     571          return;
     572        }
     573        pt = href_path.replace(/(javascript|changeImgSrc)|[('):]/gi, "");
     574
     575        patname = href_path.replace("javascript\:", "");
     576        if (typeof old_path == "undefined") old_path = patname;
     577        pt = pt.split(",");
     578        tsz = pt[pt.length - 1];
     579        if (!maxi_display)
     580          jQuery(this).css('visibility', 'visible');
     581        else {
     582          jQuery(this).next().next().remove();
     583          jQuery(this).next().remove();
     584          jQuery(this).remove();
     585        }
     586        // --- recherche limite ---
     587
     588        if (!options.valide && (tsz == "Autosize" || tsz == "SelMaxi")) {
     589          jQuery(this).next().next().remove();
     590          jQuery(this).next().remove();
     591          jQuery(this).remove();
     592        } else {
     593          if (tsz == "Original" && (pictureSelType_Maxi != "Autosize" && pictureSelType_Maxi != "SelMaxi")) {
     594            maxi_display = true;
     595          } else if (tsz == pictureSelType_Maxi && (pictureSelType_Maxi != "Autosize" && pictureSelType_Maxi != "SelMaxi")) {
     596            maxi_display = true;
     597
     598          } else if (tsz == "Autosize" || tsz == "SelMaxi") {
     599            patname = old_path.replace("')", "','" + tsz + "')");
     600          } else
     601            old_path = patname;
     602          path_names.push(patname);
     603        }
     604        // --- type en cours ---
     605        if (tsz.match(RegExp("^" + options.pictureDeriv, "gi"))) {
     606          us = n;
     607        }
     608        n++;
     609      });
     610    }; // _____ fin Affiche_limite ____
     611    if (DEBUG_autosize.match(new RegExp("noresize", "gi"))) {
     612      Ajuste_Liens();
     613      Save_cookies();
     614      return;
     615
     616    }
     617    // auto_details
     618    // ==== limite affichage selection = select_type ====
     619
     620
     621
     622
     623    /***************************************************************************
     624    * window LOAD
     625    **************************************************************************/
     626    jQuery(window).load(function () {
     627      location_href = location.href;
     628      // =======================================================================
     629      infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });        // Image
     630      if (infos_theMainImage.src.match(RegExp("gif", "gi"))) {
     631        setTimeout(function (i) {
     632          jQuery(window).load();
     633        }, 500);
     634        return;
     635      };
     636      infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();         // Cadre
     637      infos_theContainer = jQuery(theImage_id).infos({ absolute: true });   // conteneur
     638
     639      // general
     640      if (infos_theMainImage.width == 0) {
     641        if (Type_Img == "pamoorama") {
     642          theMainImage_id = "#pamoorama";
     643          infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });
     644          infos_theMainImage.width = options.scaled_width;
     645          infos_theMainImage.height = options.scaled_height;
     646          options.valide = true;
     647        } else if (Type_Img == "charlie") {
     648          theMainImage_id = "#charlie";
     649          infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });
     650          options.valide = true;
     651        } else if (Type_Img == "iframe") {
     652
     653          infos_theMainImage = jQuery("#iframe").infos({ absolute: true });
     654          options.valide = true;
     655          infos_theMainImage.width = infos_theContainer.general.width;
     656          infos_theMainImage.height = infos_window.height - infos_theContainer.top - options.marge_basse;
     657          jQuery("#iframe").width(infos_theMainImage.width);
     658          jQuery("#iframe").height(infos_theMainImage.height);
     659
     660        } else {
     661          jQuery("img").each(function (i) {
     662            imgSrc = options.imgSrc;
     663          });
     664          infos_theMainImage = jQuery("#theImage img").infos({ absolute: true });
     665        }
     666        if (infos_theMainImage.id == "") {
     667          jQuery("#theImage img").attr("id", "theMainImage");
     668          infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });
     669        }
     670
     671      }
     672      if (Type_Img == "charlie" || Type_Img == "iframe") {
     673        options.scaled_width = options.theMainImageWidth;
     674        options.scaled_height = options.theMainImageHeight;
     675      }
     676
     677      if (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi") {
     678        jQuery('#derivativeSwitchLink').show();
     679      }
     680      if (test_theme("simple")) {
     681        jQuery(theMainImage_id).css({ maxWidth: "none" });
     682        theImageAndInfos_id = "#content";
     683        infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre
     684        // general
     685        infos_theContainer.height = infos_window.height - infos_theContainer.top;
     686        // jQuery(theImage_id).height(infos_theContainer.height);
     687
     688      } else {
     689        infos_theImageAndInfos = jQuery(theImageAndInfos_id).infos();  // Cadre
     690        // general
     691        if (infos_theImageAndInfos.visible == false)
     692          theImageAndInfos_id = "#imageContainer";
     693      }
     694
     695
     696      imageInfos_id = "#imageInfos";
     697      content_id = "#content";
     698      infos_content = jQuery(content_id).infos({ absolute: true });                 // conteneur
     699      infos_imageInfos = jQuery(imageInfos_id).infos({ absolute: true });            // information
     700      infos_copyright = jQuery("#copyright").infos({ absolute: true });
     701
     702
     703      if (infos_theContainer.top > infos_window.height) {
     704        zheight = infos_window.height - infos_content.top;
     705      } else {
     706        zheight = infos_window.height - (infos_theContainer.top);
     707      }
     708
     709
     710      if (options.check_desc_v) { }
     711
     712      infos_comments = jQuery("#comments").infos({ absolute: true });
     713      infos_Licence = jQuery(".licencetag").infos({ absolute: true });
     714      infos_imageComment = jQuery(imageComment_id).infos({ absolute: true });
     715
     716      if (test_theme("simple")) {
     717
     718
     719      } else {
     720        if (test_theme("stripped")) {
     721
     722        } else
     723
     724          if (test_theme("blanc , pure, hr_ ")) {
     725            options.marge_gauche += 10;
     726            options.marge_droite += 10;
     727          }
     728      }
     729      // ==============================================================================
     730
     731      infos_theMainImage.height = infos_theMainImage.height | zheight;
     732
     733      if (infos_theMainImage.height > 0) {
     734        rapport_i = Math.ceil(infos_theMainImage.width / infos_theMainImage.height);
     735
     736        Zone_image = {
     737          image_init: {
     738            width: options.scaled_width, height: options.scaled_height,
     739            rapport: options.ratio
     740          },
     741          image: {
     742            width: infos_theContainer.width,
     743            height: infos_window.height - infos_theContainer.top - options.marge_basse,
     744            rapport: rapport_i
     745          },
     746          container: {
     747            width: infos_theContainer.general.width,
     748            height: zheight,
     749            margesWidth: infos_window.width - infos_theContainer.width
     750          }, marges: {
     751            height: 0,
     752            width: 0
     753          },
     754          zoom: Math.ceil(infos_theContainer.width / infos_theMainImage.width)
     755        };
     756
     757      }
     758      // ========================================================================
     759
     760      /***********************************************************************
     761      * RESIZE (une fois document chargé)
     762      **********************************************************************/
     763
     764      jQuery(window).resize(function (event, ui) {
     765        Autosize_resize(true, options);
     766      });
     767      // _____________ widow.resize _______________
     768
     769      type_src = "div";
     770      old_window = { width: 0, height: 0 };
     771      List_autosize = new Array();
     772      nu_img = 0;
     773      tempo = 0;
     774
     775
     776      infos_llgbo = jQuery(llgbo_id).infos({ absolute: true });
     777      infos_llgboh2 = jQuery("#llgboh2").infos({ absolute: true });
     778      marges_llgbo = 0;
     779      // ==========================================================================================
     780      init_gen();
     781    });
     782    // __________________window.onload_________________
     783
     784
     785    // =============================================================
     786    // REPONSE ACTION
     787    // =============================================================
     788    theMainImage_st = false;
     789    jQuery("#reset").click(function () {
     790      location.reload();
     791    });
     792
     793
     794    // ===========================================================
     795    // REPONSE TRIGGER
     796    // ===========================================================
     797    jQuery('#ret_autosize').live('ON', function (e) {
     798      if (nu_img == "") nu_img = 8;
     799      jQuery(jQuery('.debug').get(nu_img)).trigger('ON');
     800
     801    });
     802
     803    // ==========================================================
     804    jQuery("map area").mouseover(function (e) {
     805      try {
     806        nok = theImg.useMap;
     807        hok = this;
     808      }
     809      catch (r) {
     810
     811      }
     812    });
     813
     814    // ==================================
     815    // jQuery("#llgbo").trigger("ON");
     816    // ==================================
     817    jQuery(llgbo_id).live('ON', function (e) {
     818      n_id = this;
     819      infos_llgbo = jQuery(llgbo_id).infos();
     820      if (infos_llgbo.visible == false) return;
     821
     822      marges_llgbo = 0;
     823      if (infos_llgbo.height > 0) {
     824        infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos();
     825        infos_llgboframe31 = jQuery(llgbo_id + "  div:first").infos();
     826        // =============================================
     827        ll2 = infos_llgboframe1.width; // llgboframe1 interieur
     828        ll1 = infos_llgboframe31.exterieur.width; // llgboframe31 avec border
     829        // width
     830        options.marges_llgbo = (ll1 - ll2);
     831        infos_llgboh2 = jQuery("#llgboh2").infos();
     832      }
     833    });
     834    // ==============================
     835    // jQuery("#mapPicture").trigger("ON");
     836    // ==============================
     837    jQuery("#mapPicture").live('ON', function (e) {
     838      p2 = jQuery("#infoSwitcher").infos();
     839    });
     840    // ==============================
     841    // jQuery("#map").trigger("ON");
     842    // ==============================
     843    jQuery("#map").live('ON', function (e) {
     844      p2 = jQuery("#map").infos();
     845    });
     846    // ===================================
     847    // jQuery(theImage_id).trigger("ON");
     848    // ===================================
     849    jQuery("#imageInfos").live('on', function (e) {
     850      target = e.target.id;
     851    });
     852
     853    // ===================================
     854    // jQuery(theImage_id).trigger("ON");
     855    // ===================================
     856    jQuery(theImage_id).live('ON', function (e) {
     857      target = e.target.id;
     858
     859      id = this.id;
     860      Select_Image(); // +calcul
     861    });
     862
     863    jQuery("#theMainImage").load(function (e) {
     864      if (!e.target.src) return;
     865      if (e.target.src.match(RegExp("gif", "gi"))) {
     866        target = theImg.src;
     867      };
     868
     869    });
     870    jQuery("#theMainImage").resize(function (e) {
     871
     872      if (!e.target.src) return;
     873      //loaded ajax .gif
     874      if (e.target.src.match(RegExp("\.gif", "gi"))) {
     875        target = theImg.src;
     876      };
     877
     878    });
     879
     880
     881    // =================================================================
     882    jQuery(document).live('gallyInterfaceReady', function (e) {
     883      i = jQuery(this).text();
     884      jQuery(this).trigger('ON');
     885    }
     886
     887          );
     888
     889
     890    /***************************************************************************
     891    *
     892    **************************************************************************/
     893    jQuery(theImage_id).resize(function (e) {
     894      nu_img = 0;
     895    });
     896    jQuery("#menuSwitcher,#infoSwitcher").click(function (e) {
     897      options.set_sw = this.id;
     898      setTimeout(function () { div_resize(); }, 10);
     899      nu_img = 0;
     900    });
     901
     902    div_resize = function (i) {
     903
     904      jQuery(theImage_id).trigger("resize");
     905      /*
     906      * if (jQuery(theImage_id).width() != old_width) { setTimeout(function () {
     907      * div_resize() }, 10); }
     908      */
     909    };
     910    // ===========================================
     911    // jQuery("#theImageAndInfos").trigger("ON");
     912    // ===========================================
     913    jQuery("#theImageAndInfos").live('ON', function (e) {
     914      infos_theImageAndInfos = jQuery("#theImageAndInfos").infos();
     915      // setTimeout(function () { Autosize_resize(true) }, 100);
     916      nu_img = 0;
     917    }); // fin click #theImageAndInfos ON
     918
     919
     920    jQuery("#theImageAndInfos").resize(function (e) {
     921      nu_img = 0;
     922    });
     923
     924
     925    jQuery("#linkAutosize").click(function (e) {
     926      nu_img = 0;
     927    });
     928    // ==================================
     929    //
     930    // ===================================
     931    jQuery('#derivativeCheckedAutosize').click(function () {
     932      try {
     933        pathnames = jQuery(this).attr("href").split(":");
     934
     935        // eval(pathnames[1]);
     936      } catch (e) {
     937        n = false;
     938      }
     939    }); // fin click derivativeCheckedAutosize
     940    // ====================================================
     941    if (typeof decode_href != 'function') {
     942      function decode_href(myObj) {
     943        retour = { source: null,
     944          pictureDeriv: null,
     945          pictureMap: null,
     946          pictureSelType: null
     947        };
     948        hrefPath = jQuery(myObj).attr("href");
     949        if (hrefPath.indexOf("changeImgSrc") < 0) {
     950          pt = hrefPath;
     951        } else {
     952          pt = hrefPath.replace(/(javascript|phpWGOpenWindow|javascript|changeImgSrc)|[('):]/gi, "");
     953
     954        }
     955        pt = pt.split(",");
     956        retour.source = pt[0];
     957        if (hrefPath.indexOf("phpWGOpenWindow") < 0) {
     958          retour.pictureDeriv = pt[1];
     959          retour.pictureMap = pt[2];
     960          retour.pictureSelType = pt[pt.length - 1];
     961        } else {
     962          retour.pictureDeriv = options.pictureDeriv;
     963          retour.pictureMap = options.pictureMap;
     964          retour.pictureSelType = options.pictureSelType;
     965        }
     966
     967        return retour;
     968      }
     969    }
     970
     971
     972
     973    jQuery("input").click(function () {
     974      if (this.name.match(RegExp("_enabled", "gi"))) {
     975        sel = "[name*=" + this.name + "]";
     976        obj = jQuery("tr" + sel);
     977
     978        if (this.checked)
     979          obj.css({ backgroundColor: "green", color: "white" });
     980        else
     981          obj.css({ backgroundColor: "red", color: "white" });
     982        return;
     983      }
     984      return;
     985    });
     986
     987
     988    // ====================================
     989    Autosize_init = function (name, value) {
     990      img_defaut = { height: options.scaled_height, width: options.scaled_width };
     991      img_reelle = { height: options.theMainImageHeight, width: options.MaintheImageWidth };
     992      img_container = { height: options.theContainerHeight, width: options.theContainerWidth };  // taille
     993      // initiale
     994
     995      img_finale = img_init;
     996
     997      useMap = infos_theMainImage.useMap; // #mapmedium
     998
     999      useMap = options.pictureMap; // #mapxxx
     1000      pictureDeriv = options.pictureDeriv; // picturederiv xxx
     1001
     1002
     1003      old_img = options.imgSrc;
     1004      old_window_height = options.windowHeight || jQuery(window).height();
     1005      old_window_width = options.windowWidth || jQuery(window).width();
     1006      old_img_h = options.imgHeight;
     1007      old_img_w = options.imgWidth;
     1008      if (infos_theMainImage.visible == true) {
     1009        theImg = document.getElementById(theMainImage_id.replace("#", ""));
     1010        theImg.useMap = useMap;
     1011      }
     1012
     1013
     1014    };
     1015    // ____________________ Autosize_init _____________________
     1016
     1017    /***************************************************************************
     1018    * Autosize_resize
     1019    **************************************************************************/
     1020    Autosize_resize = function (force, parametres) {
     1021      if (!force) {
     1022        cookis = Get_cookies();
     1023        if (cookis.pictureSelType != options.pictureSelType) {
     1024          n = 0;
     1025        }
     1026      }
     1027      nauto = Get_dimensions(true, parametres);
     1028      if (nauto == "Wait") {
     1029        setTimeout(function (force, parametres) { Autosize_resize(force, parametres); }, 100);
     1030        return;
     1031      }
     1032
     1033      if (!options.valide || !nauto || (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi")) {
     1034        if (options.imageAutosize == true) {
     1035          options.pictureSelType = options.pictureDeriv;
     1036          Zone_image.image_init.width = jQuery(theImg).width();
     1037          Zone_image.image_init.height = jQuery(theImg).height();
     1038          set_cl("no");
     1039          Set_llbgo(true);
     1040          return;
     1041        }
     1042        // jQuery(theImg).width(Zone_image.image_init.width);
     1043        for (n in options.liste_type) {
     1044          if (options.liste_type[n][0] == options.pictureSelType) {
     1045            Zone_image.image_init.height = options.liste_type[n][3];
     1046            Zone_image.image_init.width = options.liste_type[n][2];
     1047            break;
     1048          }
     1049        }
     1050
     1051
     1052        jQuery(theImg).height(Zone_image.image_init.height);
     1053        set_cl("no");
     1054        Set_llbgo(true);
     1055        return;
     1056      }
     1057      infos_theContainer = jQuery(theImage_id).infos({ absolute: true });
     1058      if (typeof img_finale.width == "undefined")
     1059        img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
     1060      if (img_finale.width && (img_finale.width != Zone_image.image.width ||
     1061          img_finale.height != Zone_image.image.height)) {
     1062        if (Type_Img == "pamoorama") {
     1063          img_finale.height = Zone_image.image.height;
     1064        } else
     1065          img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
     1066      }
     1067
     1068      // ======================================================
     1069
     1070      affiche_debug({
     1071        Debug1: Debug_info(1, "Cont:" + infos_theContainer.width
     1072    + " X " + infos_theContainer.height
     1073    + " IMG: " + img_finale.width
     1074    + " X " + img_finale.height
     1075    + " mgw : " + Zone_image.marges.width
     1076    , "->")
     1077      });
     1078      if (Type_Img == "pamoorama") {
     1079        // img_finale.width = Zone d'affichage :
     1080
     1081        if (nopano) {
     1082          jQuery(theMainImage_id).width(img_finale.width);
     1083          jQuery(theMainImage_id).height(img_finale.height);
     1084          infos_pamoorama = jQuery(theMainImage_id).infos({ absolute: true });
     1085          Set_Pamoorama({ width: img_finale.width, height: img_finale.height });
     1086        }
     1087
     1088      } else if (Type_Img == "panorama") {
     1089        // jQuery("#pamoorama").width(img_finale.width);
     1090        // jQuery("#pamoorama").height(img_finale.height);
     1091
     1092
     1093
     1094        // jQuery("#theImage img.simple_panorama").panorama(asp_options);
     1095      } else {
     1096        if (options.imageAutosize == false)
     1097          if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
     1098            jQuery(theMainImage_id).height(Zone_image.image.height);
     1099            r1 = infos_theContainer.width / infos_theContainer.height;
     1100            jQuery(theMainImage_id).css("margin-top", options.marge_haute);
     1101          } else {
     1102            jQuery(theMainImage_id).width(Zone_image.image_init.width);
     1103            jQuery(theMainImage_id).height(Zone_image.image_init.height);
     1104          }
     1105        if (Type_Img == "charlie" || Type_Img == "iframe") {
     1106          init_w1 = Zone_image.image.width;
     1107          init_h1 = Zone_image.image.height;
     1108          if (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi") {
     1109            init_w1 = Autosize_options.ideal_size_width;
     1110            init_h1 = Autosize_options.ideal_size_height;
     1111          }
     1112          if (Type_Img == "charlie") {
     1113            the_mainImage_html = jQuery(theMainImage_id).html();
     1114            img_objs = jQuery("#charlie object,#charlie embed");
     1115            if (img_objs.length > 0) {
     1116              jQuery(img_objs).each(function (e) {
     1117             //   init_h1 = jQuery(this).height();
     1118             //   init_w1 = jQuery(this).width();
     1119              }); 
     1120            }
     1121            dp1 = jQuery("#charlie").offset();
     1122            dp = jQuery(img_objs).offset();
     1123            if (dp) { if (wpng == 0) wpng = Math.abs(dp.left - dp1.left) * 2; }
     1124            png_h = init_h1; w01 = init_w1 - wpng;
     1125            if (!png_h) {
     1126              png_h = jQuery("#theMainImage").height();
     1127              h01 = png_h;
     1128            }
     1129            else
     1130              h01 = Math.ceil(w01 / Zone_image.image.rapport);
     1131            // ==== Zone Affichage  =====
     1132            if (h01 > png_h) {
     1133              h01 = png_h;
     1134              w01 = Math.ceil(h01 * Zone_image.image.rapport);
     1135            }
     1136            jQuery("#theMainImage").height(png_h );
     1137            jQuery("#theMainImage").width(w01 + wpng);
     1138            jQuery("#theMainImage").css({ verticalAlign: "middle",
     1139              textAlign: "center", margin: "auto"
     1140            });
     1141
     1142            if (jQuery("#theMainImage_vid").length > 0) {
     1143              jQuery("#theMainImage_vid").attr("width", w01);
     1144              jQuery("#theMainImage_vid").attr("height", h01);
     1145            }
     1146            if (jQuery("video").length > 0) {
     1147              jQuery("video").attr("width", w01);
     1148              jQuery("video").attr("height", h01);
     1149            }
     1150            jQuery("#" + Type_Img).height(png_h);
     1151            jQuery("#" + Type_Img + "div").width(w01);
     1152            jQuery(theImage_id).css({ height: "auto" });
     1153
     1154
     1155       //     jQuery("#charlie object").attr("width", w01);
     1156            jQuery("#charlie    object").attr("height", h01);
     1157        //    jQuery("#charlie embed").attr("width", w01); // firefox opera
     1158            jQuery("#charlie embed").attr("height", h01);
     1159            jQuery("#charlie  embed").css("margin", "auto");
     1160
     1161          } else {
     1162            jQuery(theImage_id).css({ height: "auto" });
     1163            jQuery("#theMainImage").css({ width: "auto", height: "auto" });
     1164            jQuery("#" + Type_Img).attr("width", init_w1 - (infos_theMainImage.borderwidth.left + infos_theMainImage.borderwidth.right));
     1165            jQuery("#" + Type_Img).attr("height", init_h1 - (infos_theMainImage.borderwidth.top + infos_theMainImage.borderwidth.bottom));
     1166          }
     1167          // jQuery("#" + Type_Img).show(fade_in);
     1168        }
     1169
     1170
     1171      }
     1172
     1173      set_cl();
     1174      Set_llbgo(true);
     1175      return true;
     1176    };
     1177    // _________________Autosize ____________________________________
     1178
     1179
     1180    /***************************************************************************
     1181    * theMainImage_id=pamoorama
     1182    **************************************************************************/
     1183    /***************************************************************************
     1184    * Wait_pamoorama
     1185    **************************************************************************/
     1186
     1187    Wait_pamoorama = function () {
     1188      if (Type_Img != "pamoorama") return true;
     1189      if (nopano == true) return true;
     1190      mypanorama = window.myPamoorama;
     1191      if (mypanorama) {
     1192        jQuery(mypanorama).live('ON', function (e) {
     1193          jQuery(jQuery('.debug').get(1)).trigger('ON');
     1194          Autosize_resize(true, options);
     1195          jQuery("#pamoorama").fadeTo(fade_in + 20, 1);
     1196        });
     1197
     1198        // ===============================================
     1199        // jQuery(theImage_id).trigger("Start_right");
     1200        // ===============================================
     1201        jQuery(mypanorama).live('Start_right', function (e) {
     1202          if (typeof Zone_image == "undefined") return
     1203          test_w = window.myPamoorama.autoSlideFx.to;
     1204          test_w = window.myPamoorama.autoScrollFx.to;
     1205          nf = jQuery("#pamoorama_thumb").height();
     1206          jQuery("#pamoorama_thumb img").width(200);
     1207          jQuery("#pamoorama_thumb img").height(nf);
     1208          // 200=window.myPamoorama.imageWidth
     1209          // frame = Zone_image.container.width
     1210          nw = (200 * Zone_image.image.width) / window.myPamoorama.imageWidth;
     1211          jQuery("#pamoorama_frame").width(nw);
     1212        });
     1213        // ===============================================
     1214        // jQuery(theImage_id).trigger("Start_left");
     1215        // ===============================================
     1216        jQuery(mypanorama).live('Start_left', function (e) {
     1217          if (typeof Zone_image == "undefined") return
     1218          jQuery(theImage_id).show(0);
     1219          window.myPamoorama.autoSlideFx.to = 0;
     1220          test_w = window.myPamoorama.autoSlideFx.to;
     1221          test_w = window.myPamoorama.autoScrollFx.to;
     1222          nf = jQuery("#pamoorama_thumb").height();
     1223          jQuery("#pamoorama_thumb img").width(200);
     1224          jQuery("#pamoorama_thumb img").height(nf);
     1225        });
     1226      }
     1227      // =============================================================
     1228      if (mypanorama && typeof mypanorama.imageHeight != "undefined" && mypanorama.skipInit == true) {
     1229        nopano = true;
     1230        Zone_image.image_init = {
     1231          width: mypanorama.imageWidth,
     1232          height: mypanorama.imageHeight,
     1233          rapport: Math.ceil(mypanorama.imageWidth / mypanorama.imageHeight)
     1234        };
     1235        Autosize_resize();
     1236
     1237      } else {
     1238
     1239        setTimeout(function () {
     1240          Wait_pamoorama();
     1241        }, 500);
     1242      };
     1243
     1244      return true;
     1245
     1246    };
     1247    // __________________ Wait_pamoorama ______________________
     1248    jQuery(".pwg-icon-clock-minus, .pwg-icon-clock-plus").click(function (i) {
     1249
     1250    }).mouseover(function (i) {
     1251
     1252    });
     1253
     1254
     1255
     1256    /***************************************************************************
     1257    *
     1258    **************************************************************************/
     1259    Wait_Affichage = function () {
     1260      Wait_Affichage_st = false;
     1261      while (Wait_Affichage_st == false) {
     1262        jQuery.noop();
     1263        Wait_Affichage_st = Wait_Affichage_time();
     1264      }
     1265    };
     1266    // __________________ Wait_Affichage ______________________
     1267
     1268
     1269    Wait_Affichage_time = function () {
     1270      // if (nu_img > 1) return;
     1271      if (typeof stb != "undefined")
     1272        stb.stop().fadeTo(3500, 0);
     1273      if (typeof theMainImage_id == "undefined") return true;
     1274
     1275      if (theMainImage_id.selector) {
     1276        theMainImage_id = theMainImage_id.selector;
     1277      }
     1278      if (theMainImage_id == null) return;
     1279
     1280      if (jQuery(theMainImage_id).length == 0) {
     1281        if (jQuery("#pamoorama_inner").length > 0) {
     1282          return true;
     1283        }
     1284        // === attente Image chargée ===
     1285        if (tempo > 100) return true;
     1286        tempo++;
     1287        setTimeout(function () { Wait_Affichage_time(); }, 500);
     1288        return false;
     1289
     1290      } else {
     1291
     1292        img_h = jQuery(theMainImage_id).height();
     1293        img_w = jQuery(theMainImage_id).width();
     1294
     1295        if (typeof infos_theContainer == "undefined") return;
     1296        jQuery("#ret_autosize").trigger('ON', {
     1297          width: img_w,
     1298          height: img_h,
     1299          theImage: theMainImage_id,
     1300          img_src: infos_theMainImage.src,
     1301          window_height: infos_theContainer.height,
     1302          window_width: infos_theContainer.width
     1303        });
     1304      }
     1305      return true;
     1306    };
     1307    // ______________ Wait_affichage ______
     1308
     1309
     1310    /***************************************************************************
     1311    *
     1312    **************************************************************************/
     1313    init_img = function (theImg) {
     1314      if (theImg.complete == false) {
     1315        return;
     1316      }
     1317      name_src = theImg.src;
     1318      stx = name_src.match(RegExp(Zone_image.src, "gi"));
     1319      if (stx == null) {
     1320        return false;
     1321      }
     1322      img_init = { width: jQuery(theImg).width(), height: jQuery(theImg).height() };
     1323
     1324      if (typeof theImg.naturalWidth != "undefined")
     1325        img_init.width = theImg.naturalWidth;
     1326      if (typeof theImg.naturalHeight != "undefined")
     1327        img_init.height = theImg.naturalHeight;
     1328      img_init.rapport = img_init.width / img_init.height;
     1329      if (typeof Zone_image == "undefined") Zone_image = { image: {} };
     1330      if (typeof Zone_image.image == "undefined")
     1331        Zone_image.image = { height: Zone_image.image_init.height, width: Zone_image.image_init.width };
     1332      // theImg.height = img_init.height;
     1333      // theImg.width = img_init.width;
     1334
     1335      Zone_image.image_init = { height: img_init.height, width: img_init.width, rapport: img_init.rapport };
     1336      Zone_image.zoom = Zone_image.image_init.height / img_init.height;
     1337
     1338      if (typeof Zone_image.src == "undefined") {
     1339        Zone_image.src = name_src;
     1340        return false;
     1341      }
     1342      stx = name_src.match(RegExp(Zone_image.src, "gi"));
     1343      return stx;
     1344    };
     1345    // ___________ init_img _______
     1346
     1347
     1348
     1349    // ===========================================
     1350    //
     1351    // ===========================================
     1352    Set_Map = function (nds) {
     1353      p0 = jQuery("#map").offset();
     1354      if (!p0) return;
     1355      infos_mapPicture = jQuery("#mapPicture").infos({ absolute: true });
     1356      infos_theContainer = jQuery(theImage_id).infos({ absolute: true });
     1357      jQuery("#map").removeAttr("height");
     1358      jQuery("#map").removeAttr("width");
     1359      jQuery("#map").width(infos_theContainer.width - (infos_mapPicture.width));
     1360      jQuery("#map").height(jQuery(window).height() - infos_theContainer.top - infos_theContainer.general.marges.height);
     1361      return true;
     1362    };
     1363
     1364    jQuery("map [name='#Autosize'] area").mouseover(function (e) {
     1365      return;
     1366    });
     1367    // ___ Set_Map ___
     1368
     1369    // =====================================
     1370    //
     1371    // =====================================
     1372    Get_Maxi = function (Maxi_image) {
     1373      var pt = options.liste_type;
     1374      if (pt.length > 0) {
     1375        tw = Maxi_image.width;  // valeur maxi
     1376        th = Maxi_image.height;  // valeur maxi
     1377        n = 0;
     1378        maxi_size = { w: Maxi_image.width, h: Maxi_image.height, idx: -1 };
     1379        mini_size = { w: tw, h: th, idx: 0 };
     1380        size_derive = { w: 0, h: 0 };
     1381        size_encours = { w: tw, h: th };
     1382        // =================================
     1383        jQuery(pt).each(function (i) {
     1384          vn = this;
     1385          v_pictureDeriv = vn[0]; v_imgSrc = vn[1]; v_width = parseInt(vn[2]); v_height = parseInt(vn[3]);
     1386          size_derive = { w: v_width, h: v_height };
     1387          if (v_pictureDeriv == options.pictureSelType) {
     1388            maxi_size = size_derive;
     1389            maxi_size.idx = n;
     1390            return false;
     1391          }
     1392
     1393          if (v_pictureDeriv != "square" && v_pictureDeriv != "thumb" && v_pictureDeriv != "SelMaxi" && v_pictureDeriv != "Autosize") {
     1394            if (size_derive.h > size_encours.h || v_pictureDeriv == "Original") {
     1395              if (maxi_size.idx < 0) {
     1396                maxi_size = size_derive;
     1397                maxi_size.idx = n;
     1398                if (options.pictureSelType == "SelMaxi" || options.pictureSelType == "Autosize")
     1399                  return false;
     1400              }
     1401            }
     1402            if (size_derive.h < size_encours.h && size_derive.h > 10) {
     1403              mini_size = size_derive;
     1404              mini_size.idx = n;
     1405            }
     1406          }
     1407          n++;
     1408        });
     1409        n = maxi_size.idx;
     1410        if (n < 0) {
     1411          n = mini_size.idx;
     1412        }
     1413        if (options.pictureSelType.match(RegExp("SelMaxi", "gi"))) {
     1414          n = mini_size.idx;
     1415
     1416        }
     1417        if (options.pictureSelType.match(RegExp("Autosize", "gi"))) {
     1418
     1419        }
     1420
     1421        pictureDeriv = pt[n][0];
     1422        last_id = pt[n][0];
     1423        jQuery(".switchCheck").each(function (i) {
     1424          if (this.id.match(RegExp("derivative", "gi"))) {
     1425            if (!this.id.match(RegExp("Original", "gi"))) {
     1426              if (this.id.match(RegExp("SelMaxi", "gi"))) return false;
     1427              last_id = this.id.replace("derivativeChecked", "");
     1428            }
     1429            if (last_id == pictureDeriv)
     1430              return false;
     1431          }
     1432        });
     1433
     1434        options.pictureDeriv = last_id;
     1435
     1436        return { url: pt[n][1], pictureDeriv: last_id, pictureMap: last_id, width: pt[n][2], height: pt[n][3] };
     1437      }
     1438      return { imgSrc: "", pictureDeriv: "", width: "", height: "" };
     1439    };
     1440    // _______________ Get_Maxi ______
     1441
     1442    /***************************************************************************
     1443    * Selection de l'image
     1444    **************************************************************************/
     1445    Select_Image = function () {
     1446      memoire = options.imgSrc;
     1447      if (options.imgSrc.match(RegExp("gif", "gi")))
     1448        return;
     1449      var pt = options.liste_type;
     1450      if (pt.length > 0) {
     1451        // ===== calcul Image ===
     1452        if (typeof imageInfos_id == "undefined") return;
     1453        if (Calcul_Image() == "Wait") {   // image en cours
     1454          return "Wait";
     1455        }
     1456        // ==================================================
     1457        options.theContainerMargeZone = Zone_image.marges;
     1458        if (Type_Img != 'charlie' && Type_Img != "pamoorama") {
     1459          IMg = Get_Maxi(Zone_image.image);
     1460          imgSrc = IMg.url;
     1461          if (options.imgSrc.match(RegExp(imgSrc, "gi")))
     1462            options.imgSrc = imgSrc;
     1463          // dimension image
     1464          img_width = IMg.width;
     1465          img_height = IMg.height;
     1466          Zone_image.image_init = { height: IMg.height,
     1467            width: IMg.width,
     1468            rapport: IMg.width / IMg.height
     1469          };
     1470          if (typeof Zone_image.image == "undefined")
     1471            Zone_image.image = { height: IMg.height,
     1472              width: IMg.width,
     1473              rapport: IMg.width / IMg.height
     1474            };
     1475        } else {
     1476          return;
     1477        }
     1478        Zone_image.zoom = Math.ceil(Zone_image.image.height / Zone_image.image_init.height);
     1479        if (!theImg.src)
     1480          return true;
     1481        if (typeof Zone_image.src == "undefined")
     1482          Zone_image.src = imgSrc;
     1483        if (typeof Zone_image.name == "undefined")
     1484          Zone_image.name = " ";
     1485        if (typeof Zone_image.path == "undefined")
     1486          Zone_image.path = " ";
     1487
     1488        imgSrcS = imgSrc.split('/');
     1489        imgSrcS = imgSrcS[imgSrcS.length - 1];
     1490        if (!theImg.src)
     1491          return true;
     1492        identique = theImg.src.match(RegExp(imgSrc, "gi"));
     1493        if (identique) return true;
     1494        href_path = get_href(IMg.pictureDeriv);
     1495
     1496        if (options.pictureSelType == "Autosize" || options.pictureSelType == "SelMaxi") {
     1497          spans = jQuery("#derivativeChecked" + options.pictureSelType).next();
     1498          spans.attr("href", "javascript:" + href_path);
     1499        }
     1500        theImg = document.getElementById(theMainImage_id.replace("#", ""));
     1501        if ((theImg == null) || theImg.tagName != "IMG") {
     1502          imgSrc_i = jQuery(theImg).css("backgroundImage");
     1503          imgSrc_j = jQuery(theImg).css("background-image");
     1504          return true;
     1505        } else {
     1506          eval(href_path);
     1507
     1508        }
     1509        theImg.useMap = "#map" + IMg.pictureMap;
     1510        return true;
     1511
     1512      } else {
     1513        return false;
     1514      }
     1515
     1516    };  // _______________ Select_Image ______
     1517
     1518
     1519    /***************************************************************************
     1520    * correction pamoorama
     1521    **************************************************************************/
     1522    Set_Pamoorama = function (Format) {
     1523      if (Type_Img == "pamoorama") {
     1524        infos_pamoorama_outter = jQuery("#pamoorama_outter").infos({ absolute: true });
     1525        infos_pamoorama_inner = jQuery("#pamoorama_inner").infos({ absolute: true });
     1526        infos_pamoorama_frame = jQuery("#pamoorama_frame").infos({ absolute: true });
     1527        infos_frame = jQuery(myPamoorama.frame).infos({ absolute: true });
     1528        // ====================================================
     1529        marges_w = infos_pamoorama.general.marges.width;
     1530        marges_h = infos_pamoorama.general.marges.height;
     1531
     1532        jQuery("#pamoorama_footer").css({
     1533          width: Format.width + "px"
     1534        });
     1535        infos_pamoorama_footer = jQuery("#pamoorama_footer").infos();
     1536        marges_h += infos_pamoorama_footer.general.height;
     1537        outter_height = Format.height;
     1538
     1539        Zoom_pano = (Format.height - marges_h) / Zone_image.image_init.height;
     1540        new_image = { height: Math.ceil(Zone_image.image_init.height * Zoom_pano),
     1541          width: Math.ceil(Zone_image.image_init.width * Zoom_pano)
     1542        };
     1543
     1544        jQuery("#pamoorama_inner").css({
     1545          width: new_image.width + "px", height: new_image.height + "px", "background-size": "100%"
     1546        });
     1547        // ---------- test largeur image
     1548        new_width = Format.width; // -(options.marge_right +
     1549        // options.marge_left);
     1550
     1551        if (new_width > new_image.width) {
     1552          new_width = new_image.width;
     1553          jQuery("#pamoorama_outter").css({
     1554
     1555            align: "center",
     1556            margin: "0"
     1557          });
     1558        }
     1559        outter_width = new_width;
     1560
     1561        jQuery("#pamoorama_outter").css({
     1562          align: 'center',
     1563          margin: 'auto',
     1564          width: outter_width + "px",
     1565          height: Format.height - marges_h + "px"
     1566        });
     1567        // ============= Mise à l'echelle ==================
     1568        window.myPamoorama.options.width = Math.ceil(Format.width);
     1569        // ==================================================================
     1570        new_max_left = new_image.width - outter_width;
     1571        if (!window.myPamoorama.outter) return;
     1572        window.myPamoorama.outter.scrollTo(new_max_left, 0);
     1573
     1574        if (typeof window.myPamoorama.autoScrollFx != "undefined") window.myPamoorama.autoScrollFx.to = new Array(new_max_left, 0);
     1575        window.myPamoorama.ratio = Math.ceil(new_image.width / 200);
     1576        window.myPamoorama.imageWidth = new_image.width;
     1577        window.myPamoorama.imageHeight = new_image.height;
     1578        nf = jQuery("#pamoorama_thumb").height();
     1579        jQuery("#pamoorama_thumb img").width(200);
     1580        jQuery("#pamoorama_thumb img").height(nf);
     1581
     1582        jQuery("#pamoorama_thumb").css({
     1583          /* position: "absolute", */
     1584          left: (Format.width - 215) + "px"
     1585
     1586        });
     1587        jQuery("#pamoorama_thumb img").css({
     1588
     1589        });
     1590        // 200=window.myPamoorama.width
     1591        // frame = Zone_image.container.width
     1592
     1593        nw = (window.myPamoorama.image.width * Format.width) / window.myPamoorama.imageWidth;
     1594        jQuery("#pamoorama_frame").width(nw);
     1595
     1596
     1597        if (window.myPamoorama.options.autoscrollOnLoad && infos_frame) {
     1598          window.myPamoorama.startAnimRight();
     1599        }
     1600      } // 
     1601    }; // Set_Pamoorama
     1602
     1603    /** ****************************************************** */
     1604
     1605    Toggle_bp = function () {
     1606      options.cl_visible = !options.cl_visible;
     1607      Autosize_resize();
     1608      Wait_Affichage();
     1609
     1610    };
     1611
     1612    // ====================================
     1613    //
     1614    // ====================================
     1615    Calcul_Image = function () {
     1616
     1617      /** ************************************* */
     1618      if (typeof imageInfos_id == "undefined") return;
     1619      infos_imageInfos = jQuery(imageInfos_id).infos({ absolute: true });             // information
     1620      infos_theMainImage = jQuery(theMainImage_id).infos({ absolute: true });         // Image
     1621      // commentContent
     1622      // copyright
     1623
     1624      if (options.slideshow) {
     1625
     1626
     1627      } else {
     1628
     1629      }
     1630      if (typeof Zone_image.name == "undefined") {
     1631        var names = Array();
     1632        names = options.imgSrc.toString().split("/");
     1633        names = names[names.length - 1].split("-");
     1634        names = names[0].split(".");
     1635        Zone_image.name = names[0];
     1636      }
     1637
     1638      if (Type_Img == "img") {
     1639        Zone_image.src = jQuery(theMainImage_id).attr("src");
     1640        if (typeof Zone_image.src != "undefined") {
     1641          if (Zone_image.src.match(RegExp(Zone_image.name, "gi"))) {
     1642            Zone_image.path = infos_theMainImage.src;
     1643          } else
     1644            return "Wait";
     1645        } else {
     1646          Zone_image.src = "";
     1647          Zone_image.path = "";
     1648        }
     1649      } else {
     1650        Zone_image.src = jQuery(theMainImage_id).attr("src");
     1651        Zone_image.path = infos_theMainImage.src;
     1652      }
     1653      pos_top = options.pos_top;
     1654      // pos_top = infos_theContainer.top;
     1655
     1656      pos = jQuery(theImage_id).offset();
     1657      infos_theContainer = jQuery(theImage_id).infos({ absolute: true });   // container
     1658      infos_window = jQuery(window).infos({ absolute: true });   // window
     1659      w = infos_theContainer.general.marges.width;
     1660
     1661      container = {
     1662        height: infos_window.height - options.theContainerTop,
     1663        width: infos_window.width - options.theContainerLeft - options.theContainerRight
     1664      };
     1665      marge_left = options.marge_left | 0;
     1666      marge_right = options.marge_right | 0;
     1667      marge_top = options.marge_top | 0;
     1668
     1669
     1670      // ==========================================================
     1671      if (test_theme("stripped")) {
     1672        infos_the_page.margin.left = 20;  // taille fleche
     1673        infos_the_page.margin.right = 20;
     1674
     1675      } else if (test_theme("kardon")) {
     1676
     1677      } else if (test_theme("elegant")) {
     1678
     1679        if (infos_imageInfos.visible == true) {
     1680          // marge_right += infos_imageInfos.general.width; ;
     1681
     1682        } else {
     1683          marge_right += 0;
     1684
     1685        }
     1686        marge_right += 1;
     1687        marge_left += 1;
     1688
     1689      } else if (test_theme("stripped")) {
     1690
     1691      } else if (test_theme("simple")) {
     1692        infos_menubar = jQuery("#menubar").infos({ absolute: true });
     1693        infos_imageInfoBar = jQuery("#imageInfoBar").infos({ absolute: true });
     1694
     1695        if (infos_imageInfoBar.left - infos_theContainer.left - 2 > 0) {
     1696          jQuery(theImage_id).width(infos_imageInfoBar.left - infos_theContainer.left - 2);
     1697        }
     1698        marge_left += 0;
     1699        marge_right += 0;
     1700
     1701      } else if (test_theme("OS")) {
     1702
     1703      } else if (test_theme("pur")) {
     1704        marge_right += 0;
     1705        // marge_right += 25;
     1706      } else if (test_theme("mont")) {
     1707        marge_right += 0;
     1708
     1709        // marge_right += 25;
     1710
     1711
     1712      } else {
     1713
     1714
     1715
     1716      }
     1717
     1718
     1719      retrait_img = {};
     1720      // ========== Format Image ==============
     1721      retrait_img.height = Math.ceil(options.marges_llgbo || 0)
     1722      + Math.ceil(infos_theMainImage.general.marges.height) +
     1723      +Math.ceil(options.marges_llgbo || 0);
     1724      retrait_img.height += 2;
     1725
     1726
     1727      // ===============================================================
     1728      retrait_img.width = Math.ceil(infos_theMainImage.general.marges.width); // borderwidth+padding
     1729      retrait_img.width = Math.ceil(infos_theContainer.general.marges.width); // borderwidth+padding
     1730      retrait_img.width += Math.ceil(options.marges_llgbo || 0);
     1731      retrait_img.width += 2;
     1732      if (!options.check_desc_v)
     1733        options.marge_bottom_2 = 0;
     1734
     1735      marge_bottom = options.marge_bottom_2 + options.marge_bottom;
     1736      // ================== Limite Format Image =====================
     1737      container.height_interne = container.height - marge_top - marge_bottom;
     1738      container.width_interne = container.width - marge_left - marge_right;
     1739
     1740      container.height_interne = Math.max(
     1741                  container.height_interne,
     1742                  Math.ceil(options.mini_height) + retrait_img.height);
     1743      container.width_interne = Math.max(container.width_interne,
     1744                  Math.ceil(options.mini_width) + retrait_img.width);
     1745      image_max = {
     1746        height: (container.height_interne - retrait_img.height),
     1747        width: (container.width_interne - retrait_img.width)
     1748      };
     1749      // =========================
     1750      // test débordement
     1751      // =========================
     1752      height_theMainImage = Math.ceil(image_max.height);
     1753      width_theMainImage = Math.ceil(image_max.width);
     1754
     1755      if (Type_Img == "charlie") {
     1756        height_theMainImage = Math.ceil(width_theMainImage / options.ratio);
     1757
     1758        Zone_image.image_init = {
     1759          width: width_theMainImage, height: height_theMainImage,
     1760          rapport: options.ratio
     1761        };
     1762
     1763      } else if (Type_Img == "pamoorama") {
     1764        if (height_theMainImage > container.height_interne) {
     1765          n = options.pictureSelType;
     1766        }
     1767      } else {
     1768
     1769        height_theMainImage = Math.ceil(width_theMainImage / options.ratio);
     1770        // --- test si taille image inferieur au container
     1771        if (height_theMainImage > container.height_interne) {
     1772          image_max.height = container.height_interne;
     1773          image_max.width = image_max.height * Zone_image.image_init.rapport;
     1774          width_theMainImage = Math.ceil(image_max.width);
     1775          height_theMainImage = Math.ceil(image_max.height);
     1776        }
     1777        if (width_theMainImage > container.width_interne) {
     1778          image_max.width = container.width_interne;
     1779          image_max.height = image_max.width / Zone_image.image_init.rapport;
     1780          width_theMainImage = Math.ceil(image_max.width);
     1781          height_theMainImage = Math.ceil(image_max.height);
     1782
     1783        }
     1784      }
     1785      // ======== Initilisation Zone_image ===============
     1786      Zone_image.image = {
     1787        width: width_theMainImage,
     1788        height: height_theMainImage,
     1789        rapport: width_theMainImage / height_theMainImage
     1790      };
     1791      Zone_image.marges = { width: marge_left + marge_right + retrait_img.width,
     1792        height: marge_top + marge_bottom + retrait_img.height
     1793      };
     1794      return true;
     1795    };
     1796
     1797    /***************************************************************************
     1798    * Calcul les dimensions.
     1799    **************************************************************************/
     1800    Get_dimensions = function (force, parametres) {
     1801      new_img = jQuery(theMainImage_id).infos({ absolute: true });  // image
     1802      Container = jQuery(theImage_id).infos({ absolute: true });    // containeur
     1803      new_win = jQuery(window).infos({ absolute: true });           // avec
     1804      // ascenseur
     1805      options.theContainerTop = Container.top;
     1806      options.theContainerLeft = Container.left;
     1807      options.theContainerRight = (new_win.width - Container.right);
     1808      options.marge_bottom_2 = Math.ceil(Container.out.bottom - new_img.bottom); // marge
     1809      // avec
     1810      // infos
     1811      options.marge_top_2 = options.marge_top_2 | 0;
     1812      Container.out.bottom = new_win.height - options.marge_bottom_2;
     1813      options.theContainerBottom = new_win.height - Container.out.bottom;
     1814      if (options.slideshow) {
     1815        options.marge_top = 0;
     1816      } else {
     1817        options.marge_top_2 = Math.ceil(new_img.top - Container.top) + options.marge_top;
     1818      }
     1819
     1820      options.theContainerWidth = new_win.width - options.theContainerLeft - options.theContainerRight;
     1821      options.theContainerHeight = new_win.height - options.marge_top - options.theContainerBottom - options.theContainerTop;
     1822
     1823      if (Type_Img != "map" && Type_Img != "iframe")
     1824        if (Select_Image() == "Wait") {
     1825          return "Wait";
     1826        }
     1827      useMap = options.pictureSelType;
     1828      // =================================================================
     1829      switch (Type_Img) {
     1830        case "map":
     1831          if (Set_Map(true)) return false;
     1832          break;
     1833        case "panorama":
     1834          if (!theMainImage_id) {
     1835
     1836          }
     1837          infos_theContainer = jQuery(theMainImage_id).infos();
     1838          infos_the_page = jQuery("#the_page").infos();
     1839          if (typeof img_finale == "undefined")
     1840            img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
     1841          img_finale.height = infos_theContainer.height;
     1842          break;
     1843        case "img":
     1844          break;
     1845        case "img_autre":
     1846          if (!theMainImage_id) {
     1847            if (DEBUG_autosize.match("true", "gi")) alert("The_MainImage=null");
     1848            return;
     1849
     1850          }
     1851
     1852          infos_the_page = jQuery("#the_page").infos();
     1853
     1854
     1855          break;
     1856        case "embed":
     1857          //
     1858          if (infos_theMainImage.width == 0)
     1859            infos_theMainImage = jQuery("#thePicturePage").infos();
     1860          if (infos_theMainImage.width == 0)
     1861            infos_theMainImage = jQuery("#the_page").infos();
     1862          iph1 = jQuery("#theImage div").infos();
     1863          break;
     1864        case "charlie":
     1865          Zone_image.zoom = 1;
     1866          Zone_image.image.width = options.theContainerWidth;
     1867          Zone_image.image.height = options.theContainerHeight;
     1868          break;
     1869        case "iframe":
     1870          wpng = 0;
     1871          Zone_image.image.width = options.theContainerWidth;
     1872          Zone_image.image.height = options.theContainerHeight;
     1873          Zone_image.zoom = 1;
     1874          break;
     1875        case "pamoorama":
     1876          if (nopano == false) Wait_pamoorama();
     1877          break;
     1878      }
     1879      if (options.pictureSelType != "Autosize" && options.pictureSelType != "SelMaxi") return true;
     1880      if (Type_Img != "pamoorama") {
     1881        // =========== test Hauteur Mini ====================
     1882        if (Zone_image.image.height < options.mini_height2) {
     1883          Zone_image.image.height = parseInt(options.mini_height2);
     1884          Zone_image.image.width = Math.ceil(Zone_image.image.height * Zone_image.image_init.rapport);
     1885        }
     1886        // =========== test Largeur Mini ====================
     1887        if (Zone_image.image.width < options.mini_width2) {
     1888          Zone_image.image.width = parseInt(options.mini_width2);
     1889          Zone_image.image.height = Math.ceil(Zone_image.image.width / Zone_image.image_init.rapport);
     1890        }
     1891      }
     1892      // Calcul du rapport d'agrandissement
     1893      echelle_max = parseFloat(options.echelle_max, '3');
     1894      // =========== test Zoom Maxi ====================
     1895      Zone_image.zoom = Zone_image.image.height / Zone_image.image_init.height;
     1896      if (Zone_image.zoom > echelle_max) {
     1897        Zone_image.zoom = echelle_max;
     1898        if (Type_Img == "pamoorama") {
     1899          Zone_image.image.height = parseInt(Zone_image.image_init.height * Zone_image.zoom);
     1900        } else {
     1901          Zone_image.image.width = parseInt(Zone_image.image_init.width * Zone_image.zoom);
     1902
     1903          if (Zone_image.image_init.rapport > 0)
     1904            Zone_image.image.height = parseInt(Zone_image.image.width / Zone_image.image_init.rapport);
     1905        }
     1906      }
     1907      if (Type_Img != "pamoorama") {
     1908        mxi = Math.ceil(Zone_image.image.height + Zone_image.marges.height);
     1909        Zone_image.container.height = Math.max(Zone_image.container.height | mxi, mxi);
     1910        mxi = Math.ceil(Zone_image.image.width + Zone_image.marges.width);
     1911        Zone_image.container.width = Math.max(Zone_image.container.width | mxi, mxi);
     1912        img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
     1913      } else {
     1914        img_finale = { width: Zone_image.image.width, height: Zone_image.image.height };
     1915      }
     1916
     1917      return true;
     1918    };
     1919    // ________________ Get_dimensions ___________________
     1920
     1921
     1922    /***************************************************************************
     1923    * init_gen
     1924    **************************************************************************/
     1925    init_gen = function (e) {
     1926      theImg = document.getElementById(theMainImage_id.replace("#", ""));
     1927      // ==================================================
     1928      marges_llgbo = 0;
     1929      options.marges_llgbo = 0;
     1930      if (jQuery(llgbo_id).length > 0) {
     1931        infos_llgbo = jQuery(llgbo_id).infos({ absolute: true });
     1932        if (infos_llgbo.visible == true) {
     1933          if (infos_llgbo.height > 0) {
     1934            infos_llgboframe1 = jQuery(llgbo_id + " div:last").infos();
     1935            infos_llgboframe31 = jQuery(llgbo_id + "  div:first").infos();
     1936            // =============================================
     1937            ll2 = infos_llgboframe1.width; // llgboframe1
     1938            ll1 = infos_llgboframe31.general.width; // llgboframe31
     1939            options.marges_llgbo = (ll1 - ll2);
     1940            infos_llgboh2 = jQuery("#llgboh2").infos();
     1941          }
     1942        }
     1943
     1944        marges_llgbo = options.marges_llgbo;
     1945      }
     1946
     1947      // ========= Récupération des informations =============
     1948
     1949      options.marge_top = 0;
     1950      pAll = jQuery(llgbo_id).absoluteAll({ absolute: true });
     1951      infos_llgbo.top = pAll.Top;
     1952      infos_llgbo.bottom = pAll.Bottom;
     1953      pAll = jQuery(theMainImage_id).absoluteAll({ absolute: true });
     1954      pos_top = pAll.Top; ;
     1955      pos_bottom = pAll.Bottom; ;
     1956      if (infos_llgbo.top > 0) {
     1957        pos_top = infos_llgbo.top;
     1958        options.marge_top = infos_theMainImage.top - infos_theContainer.top;
     1959        options.marge_bottom = Math.ceil(options.marge_basse + options.marge_top);
     1960
     1961      } else {
     1962        pos_top = infos_theImageAndInfos.top;
     1963        options.marge_bottom = Math.ceil(options.marge_basse);
     1964      }
     1965
     1966      options.pos_top = pos_top;
     1967      new_img = jQuery(theMainImage_id).infos({ absolute: true });
     1968      Container = jQuery(theImage_id).infos({ absolute: true });
     1969      options.marge_top += Math.ceil(new_img.top - Container.top);
     1970
     1971
     1972      options.marge_left = infos_theContainer.general.marges.left + Math.ceil(options.marge_gauche);
     1973      options.marge_right = infos_theContainer.general.marges.right + Math.ceil(options.marge_droite);
     1974      options.marge_top += infos_theContainer.general.marges.top +
     1975                           infos_content.general.marges.top +
     1976                           Math.ceil(options.marge_haute);
     1977
     1978
     1979      if (options.pictureDeriv == null)
     1980        options.first = true;
     1981      else
     1982        options.first = false;
     1983      // =================== Gestion liste photos size
     1984      us = 0;
     1985      if (!options.theMainImageWidth) options.theMainImageWidth = options.scaledWidth;
     1986      if (!options.theMainImageHeight) options.theMainImageHeight = options.scaledHeight;
     1987
     1988      if (options.first) {
     1989        if (options.pictureDeriv) {
     1990
     1991          pictureSelType = options.pictureSelType;
     1992          options.pictureMap = options.pictureDeriv;
     1993
     1994        } else {
     1995          IMg = Get_Maxi(Zone_image.image);
     1996          options.pictureDeriv = IMg.pictureDeriv;
     1997          imgSrc = IMg.url;
     1998          width = IMg.width;
     1999          height = IMg.height;
     2000          options.pictureDeriv = IMg.pictureDeriv;
     2001          options.pictureMap = IMg.pictureMap;
     2002        }
     2003      }
     2004      if (pictureSelType_user != options.pictureSelType) {
     2005        /*
     2006        * user_status = options.user_status; pictureSelType_user =
     2007        * eval("options." + user_status + "_type"); //limite taille
     2008        */
     2009        pictureDeriv_user = options.pictureDeriv;
     2010        options.pictureDeriv_user = pictureDeriv_user;
     2011        pictureSelType = options.pictureSelType;
     2012      }
     2013      // Affiche_limite(pictureSelType_user);
     2014      pictureDeriv = Ajuste_Liens();
     2015
    19712016      Autosize_resize(true, options);
    19722017      Autosize_resize(true, options);
     
    20472092        Context = jQuery(this).context.nodeName;
    20482093        obj_id = "#" + this.id.toString();
    2049         infos_g = jQuery(obj_id).infos(true);
     2094        infos_g = jQuery(obj_id).infos({ absolute: true });
    20502095        infos_g.top = jQuery(obj_id).absoluteTop();
    20512096        wg = jQuery("body").width() - infos_g.right;
     
    21652210    } // Debug_pos
    21662211    // ==========================================================
    2167   });                                                                                                                                                                                                    // ready
     2212
     2213  });                                                 // ready
    21682214  jQuery("#derivativeSwitchBox a").click(function (e) {
    21692215    k1 = 0;
    21702216  });
    2171   //==========================================================
     2217  // ==========================================================
    21722218  if(typeof changeImgSrc=="undefined"){
    21732219  function changeImgSrc(url, typeSave, typeMap) {
  • extensions/Autosize/js/JScript.js

    r22218 r22360  
    2222
    2323jQuery(document).ready(function (jQuery) {
    24  
    25 
    26   jQuery(window).unload(function () {
    27     return;
    28 
    29   }); // unload
    30 
    31 
    32 
    33 
    34 
    35 
    36   jQuery(window).load(function () {
    37    
    38 
    39 
     24  jQuery(window).load(function () { 
    4025    if (jQuery("#scrolltotop").length == 0)
    4126      jQuery('#scrolltobottom').before('<div id="scrolltotop" ><a title="Revenir en haut de la page" href="#"></a></div>');
  • extensions/Autosize/js/autosize.cookie.js

    r22218 r22360  
    11if (typeof jQuery.cookie != "function") {
     2  var cookie_options = null;
     3
    24  jQuery.cookie = function (name, value, options) {
    35    if (typeof value != 'undefined') { // name and value given, set cookie
     
    2123      // in the following expressions, otherwise they evaluate to undefined
    2224      // in the packed version for some reason...
     25      cookie_options = options;
    2326      var path = options.path ? '; path=' + (options.path) : '';
    2427      var domain = options.domain ? '; domain=' + (options.domain) : '';
     
    2730    } else { // only name given, get cookie
    2831      var cookieValue = null;
     32      if (name == "*") cookieValue = new Array();
    2933      if (document.cookie && document.cookie != '') {
    3034        var cookies = document.cookie.split(';');
     
    3539            cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
    3640            break;
     41          } else if (name == "*") {
     42
     43            cookie_name = cookie.split("=")[0];
     44            cookie_value = cookie.split("=")[1];
     45            cookieValue[cookie_name] = decodeURIComponent(cookie_value);
     46
    3747          }
    3848        }
  • extensions/Autosize/js/autosizeDetect.js

    r22218 r22360  
    1 function on_load() {
    2         var myWidth = 0, myHeight = 0;
    3         if (typeof (window.innerWidth) == 'number') {
    4                 // Non-IE
    5                 myWidth = window.innerWidth;
    6                 myHeight = window.innerHeight;
    7         } else if (document.documentElement
     1jQuery(document).ready(function (jQuery) {
     2  jQuery(window).load(function (e) {
     3    var myWidth = 0, myHeight = 0;
     4    if (typeof (window.innerWidth) == 'number') {
     5      // Non-IE
     6      myWidth = window.innerWidth;
     7      myHeight = window.innerHeight;
     8    } else if (document.documentElement
    89                        && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
    9                 // IE 6+ in 'standards compliant mode'
    10                 myWidth = document.documentElement.clientWidth;
    11                 myHeight = document.documentElement.clientHeight;
    12         } else if (document.body
     10      // IE 6+ in 'standards compliant mode'
     11      myWidth = document.documentElement.clientWidth;
     12      myHeight = document.documentElement.clientHeight;
     13    } else if (document.body
    1314                        && (document.body.clientWidth || document.body.clientHeight)) {
    14                 // IE 4 compatible
    15                 myWidth = document.body.clientWidth;
    16                 myHeight = document.body.clientHeight;
    17         }
    18         windowWidth = parseInt(myWidth);
    19         windowHeight = parseInt(myHeight);
    20         theImageRight = 2;
    21         theImageLeft = 261;
    22         theImageMargeWidth = 0;
    23         theImageTop = 73;
    24         theImageBottom = 0;
    25         theImageMargeHeight = 0;
    26         jQuery.cookie('windowHeight', myHeight, {
    27                 path : COOKIE_PATH
    28         });
    29         jQuery.cookie('windowWidth', myWidth, {
    30                 path : COOKIE_PATH
    31         });
    32         jQuery.cookie('theImageRight', theImageRight, {
    33                 path : COOKIE_PATH
    34         });
    35         jQuery.cookie('theImageLeft', theImageLeft, {
    36                 path : COOKIE_PATH
    37         });
    38         jQuery.cookie('theImageMargeWidth', theImageMargeWidth, {
    39                 path : COOKIE_PATH
    40         });
    41         jQuery.cookie('theImageTop', theImageTop, {
    42                 path : COOKIE_PATH
    43         });
    44         jQuery.cookie('theImageBottom', theImageBottom, {
    45                 path : COOKIE_PATH
    46         });
    47         jQuery.cookie('theImageMargeHeight', theImageMargeHeight, {
    48                 path : COOKIE_PATH
    49         });
    50         retval = jQuery.cookie('autosize_reload');
    51         retval2 = jQuery.cookie('picture_deriv');
     15      // IE 4 compatible
     16      myWidth = document.body.clientWidth;
     17      myHeight = document.body.clientHeight;
     18    }
    5219
    53         if (!retval2)
    54           jQuery.cookie('picture_deriv','medium');
    55         //
    56         jQuery.cookie('autosize_reload', "ok", {path : COOKIE_PATH,expires:1});
     20    windowWidth = jQuery(window).width();
     21    windowHeight = jQuery(window).height();
     22    if (windowWidth != myWidth) {
     23      windowWidth = parseInt(myWidth);
     24      windowHeight = parseInt(myHeight);
     25    }
    5726
    58         if (reload == "true") {
    59                 document.location = document.location;
     27    jQuery.cookie('windowHeight', myHeight | 800, {
     28      path: COOKIE_PATH
     29    });
     30    jQuery.cookie('windowWidth', myWidth | 600, {
     31      path: COOKIE_PATH
     32    });
    6033
    61                 return;
    62                 // document.location.reload(false); // from cache
    63                 try {
     34    if (DEBUG_autosize.match(new RegExp("cookies", "gi"))) {
     35      cookies = jQuery.cookie('*');
     36      for (var i in cookies) {
     37        jQuery("div").append("<br>" + i + " = " + cookies[i]);
     38      };
     39    }
     40    jQuery.cookie('autosize_reload', "ok", { path: COOKIE_PATH, expires: 1 });
     41    if (reload == "true") {
     42      document.location = document.location;
     43    }
     44    return;
    6445
    65                         var retval = document.location.reload(true);
    66                 } catch (err) {
    67                         var retval = window.location.reload();
    68                 }
    69         }
    70 }
     46    jQuery.cookie('autosize_reload', "ok", { path: COOKIE_PATH, expires: 1 });
     47    if (reload == "true") {
     48      document.location = document.location;
     49
     50      return;
     51      // document.location.reload(false); // from cache
     52      try {
     53
     54        var retval = document.location.reload(true);
     55      } catch (err) {
     56        var retval = window.location.reload();
     57      }
     58    }
     59  }
     60
     61);
     62});
  • extensions/Autosize/js/conflit.js

    r22218 r22360  
    387387            var fname = fn.substring(fn.indexOf("function") + 8, fn.indexOf("(")) || " ";
    388388            if (fname != " ") {
    389 
    390                 jQuery.noop;
     389             
    391390                if (states.length > 0) break;
    392391
    393392                // if (fname != " $") callstack.push(fn);
    394393            } if (fname != "") {
    395                 jQuery.noop;
     394                 
    396395                // if (fname != " $") callstack.push(fn);
    397396            }
  • extensions/Autosize/main.inc.php

    r22292 r22360  
    5353                                add_event_handler('render_element_content', array(&$autosize_ctrl, 'autosize_calcContent'),EVENT_HANDLER_PRIORITY_NEUTRAL-11,2);
    5454                                add_event_handler('render_element_content', array(&$autosize_ctrl, 'init_1'),EVENT_HANDLER_PRIORITY_NEUTRAL-9,2);
    55                                 add_event_handler('render_element_content', array(&$autosize_ctrl, 'init'),EVENT_HANDLER_PRIORITY_NEUTRAL-1,2  );
     55                                add_event_handler('render_element_content', array(&$autosize_ctrl, 'init'),EVENT_HANDLER_PRIORITY_NEUTRAL-10,2  );
    5656                                add_event_handler('render_element_content', array(&$autosize_ctrl, 'init2'),EVENT_HANDLER_PRIORITY_NEUTRAL+1,2  );
    5757                                add_event_handler('loc_after_page_header',  array(&$autosize_ctrl, 'cl_autosize_script_1') );
     
    5959                                add_event_handler('loc_after_page_header',  array(&$autosize_ctrl, 'cl_autosize_script_3')  );
    6060                                add_event_handler('loc_after_page_header',  array(&$autosize_ctrl, 'cl_autosize_affiche'), EVENT_HANDLER_PRIORITY_NEUTRAL +21    );
    61                         if(!isset($_GET['slideshow'])) add_event_handler('loc_begin_picture', array(&$autosize_ctrl, 'init_3'), EVENT_HANDLER_PRIORITY_NEUTRAL+6);
     61                        if(!isset($_GET['slideshow'])) add_event_handler('loc_begin_picture', array(&$autosize_ctrl, 'init_0'), EVENT_HANDLER_PRIORITY_NEUTRAL+6);
    6262        }
    6363} ;
Note: See TracChangeset for help on using the changeset viewer.