<?php  

$visible=(isset($visible))?$visible:false; 
global $cl_version,$cl_plugin;

$cl_version=isset($cl_version)?$cl_version:"";
$cl_plugin=isset($cl_plugin)?$cl_plugin:"";

$cl_visible=isset($conf['cl_auto']) ? $conf['cl_auto'] : 
(isset($_GET['cl_visible'])?$_GET['cl_visible']:'true'); 
//===========================================================================
$cookies="' x '"; 
global $imgSizeWH ;
if(isset($_COOKIE['windowHeight'])){
$windowHeight=$_COOKIE['windowHeight'];
$windowWidth=$_COOKIE['windowWidth'];
}else{
$windowHeight=600;
$windowWidth=800;
}
global $size ;

if(!isset($imgSizeWH)){
 $imgSizeWH[0]=100;
$imgSizeWH[1]=100;
}
 
$size=	array(
            'src_img_h' => $imgSizeWH[1],
            'src_img_w' => $imgSizeWH[0],
            'window_height' =>$windowHeight,
            'window_width' => $windowWidth
          );
   
       
  $my_path = AUTOSIZE_PATH_ABS;
  $theme=$user['theme'];
  
  $user_status = $user['status'] ;
                   $template->assign( array( 
                   'AUTOSIZE_PATH_ABS' => AUTOSIZE_PATH_ABS,
                   'ROOT_URL' => ROOT_URL,
                   'AUTOSIZE_PATH' => AUTOSIZE_PATH
											)
									);	
if (!isset($conf['prefix_thumbnail'])) $conf['prefix_thumbnail']="TN_";   
//======================================================   

//=== type possible ===
 $defined_types = array_keys(ImageStdParams::get_defined_type_map());     
if(isset($defined_types))
    foreach ($defined_types as $type_size){
      $value = $type_size;
      $options[$value] = $type_size;    
    }  
 $autosize_parametres = cl_autosize_Get_Options();
 //===========================================
$COOKIE_PATH= cookie_path() ;
 global $DEBUG_autosize;

          $user_type= get_user_status($user_status)."_type";
          $user_type=  $autosize_parametres->$user_type ;  
          $select_type=ImageStdParams::get_by_type($user_type);
          $ideal_size  =  $select_type->sizing->ideal_size ;  
          if($user_type=="Autosize" || $user_type=="SelMaxi"){
              $ideal_size[0]=$imgSizeWH[0];
              $ideal_size[1]=$imgSizeWH[1];
          }

 $slide_show = isset($page['slideshow'])?$page['slideshow']:false;

  	$template->assign(
  					array(  
            'ideal_size_width' => $ideal_size[0] ,
            'ideal_size_height' => $ideal_size[1] ,
            'has_pamoorama' => $has_pamoorama,
            'pictureMap' =>   $pictureDeriv ,
            'pictureDeriv' =>   $pictureDeriv ,
            'pictureSelType' => $pictureSelType,

            'SRC_IMG' => $SRC_IMG,
            'liste_type' => $liste_type ,
            'COOKIE_PATH' =>  $COOKIE_PATH  ,
            'slide_show' => $slide_show,
             
            'ratio' =>$imgSizeWH[0]/$imgSizeWH[1] ,   
              
            'webmaster_type' => array(
                                            'OPTIONS' => $options,
                                            'SELECTED' => $autosize_parametres->webmaster_type
                                            ),
            'admin_type' => array(
                                            'OPTIONS' => $options,
                                            'SELECTED' => $autosize_parametres->admin_type
                                            ),
            'generic_type' => array(
                                            'OPTIONS' => $options,
                                            'SELECTED' => $autosize_parametres->generic_type
                                            ),
            'guest_type' => array(
                                            'OPTIONS' => $options,
                                            'SELECTED' => $autosize_parametres->guest_type
                                            ),
            'normal_type' => array(
                                            'OPTIONS' => $options,
                                            'SELECTED' => $autosize_parametres->normal_type
                                            ),

            'DEBUG_autosize' =>  $DEBUG_autosize   ,
            'cl_visible' =>  $cl_visible,
            'cl_version' => $cl_version ,
            'Version_pwg' => PHPWG_VERSION ,
            'cl_plugin' => $cl_plugin,

            'fade_in' => $autosize_parametres->fade_in,
            'thumbnail' => $conf['prefix_thumbnail'],
            'visible' => $visible,

            'theme' => $theme,

            'windowHeight' => $windowHeight,
            'windowWidth' =>  $windowWidth,

            'SCALED_WIDTH' => $imgSizeWH[0],
            'SCALED_HEIGHT' => $imgSizeWH[1],      
                          
            'theImageWidth' 	=> isset($_COOKIE['theMainImageWidth'])?$_COOKIE['theMainImageWidth']: $imgSizeWH[0],
            'theImageHeight'	=> isset($_COOKIE['theMainImageHeight'])?$_COOKIE['theMainImageHeight']:$imgSizeWH[1],
                    
            'MINI_HEIGHT' => $autosize_parametres->mini_height,
            'MINI_WIDTH' 	=> $autosize_parametres->mini_width,

            'MINI_HEIGHT2' => $autosize_parametres->mini_height2,
            'MINI_WIDTH2' 	=> $autosize_parametres->mini_width2,

            'MARGE_BASSE' => $autosize_parametres->marge_basse,
            'ECHELLE_MAX' => $autosize_parametres->echelle_max,

       
            'check_icon_v' => ($autosize_parametres->check_icon_v == 'on') ? 'checked="checked"'  : ''  ,
            'check_desc_v' => ($autosize_parametres->check_desc_v == 'on') ? 'checked="checked"'  : '' ,
            'defaut_type' => ($autosize_parametres->defaut_type == 'on') ? 'checked="defaut_type"'  : '' ,

            'webmaster_enabled' => ($autosize_parametres->webmaster_enabled == 'on') ? 'checked="checked"'  : '' ,
            'admin_enabled' => ($autosize_parametres->admin_enabled == 'on') ? 'checked="checked"'  : '' ,
            'generic_enabled' => ($autosize_parametres->generic_enabled == 'on') ? 'checked="checked"'  : '' ,
            'guest_enabled' => ($autosize_parametres->guest_enabled == 'on') ? 'checked="checked"'  : '' ,	
            'normal_enabled' => ($autosize_parametres->normal_enabled == 'on') ? 'checked="checked"'  : '' ,

            'user_status'   => get_user_status($user_status)  ,

            'Size' => $size        
					
				 )
				);	

			    
 //unset($_POST);
?>