





//display_image_properties(this.options[this.selectedIndex].value, image, 'all');
  function display_image_prop16(what)
  {
    var properties = new Array('desc_class', 'auteur_display', 'desc_display', 'date_str', 'lien','url','width','height','size','dims','titre','auteur','desc', 'margin_left', 'margin_top');
	var _p = eval('photo_'+what.options[what.selectedIndex].value);
    var _p_display = build_image_prop(_p, 70);
	
	transStart(image, template(tmp_photo, properties, _p_display));

	document.choix.ImageDESCRIPTION.value = _p.desc;	  	
  }

  function display_image_prop56(what)
  {
    //if(this.options[this.selectedIndex].value) display_photo(prepare_display_image_prop(eval('photo_'+this.options[this.selectedIndex].value), 70), image, 'all');
	if(what.options[what.selectedIndex].value) {
	  display_image_prop(eval('photo_'+what.options[what.selectedIndex].value));
	}
  }
  function display_image_prop(_p)
  {
    var vignette_dim = window.vign_dim?vign_dim:70;
    var properties = new Array('desc_class', 'auteur_display', 'desc_display', 'date_str', 'lien','url','width','height','size','dims','titre','auteur','desc', 'margin_left', 'margin_top');
    var _p_display = build_image_prop(_p, vignette_dim);
	transStart(image, template(tmp_photo, properties, _p_display));
    //display_photo(_p_display, image, 'all');
  }

function resize(w, h, maxDim)
{
  maxH = maxW = maxDim;
  ratio_w = w / maxW ; 
  ratio_h = h / maxH ; 
  ratio = ( ratio_w > ratio_h ) ? ratio_w : ratio_h ; 
  return new Array( Math.floor ( w / ratio ), Math.floor ( h / ratio )) ;
}
function certify(somme)
{
  var strprix,intprix,decprix;
  testleftm = parseInt(somme); // on mémorise la partie entière de la valeur
  testright = somme - testleftm; // on soustrait la valeur par la partie entière
  fixright = (Math.round(testright*100))/100; // on arrondit à 2 chiffres la partie décimale
  if (fixright) // si on a une valeur après la virgule
  {
	strprix=''+(eval(testleftm)+eval(fixright));
	intprix=strprix.substr(0,strprix.lastIndexOf('.')+1);
	decprix=strprix.substr((strprix.lastIndexOf('.')+1),1);
    if (fixright*100 % 10) // si c'est un modulo de 10
    {
      return ( intprix+decprix );
    }
    else // si ce n'est pas un modulo de 10
    {
      return ( intprix+decprix);
    }
  }
  else // si la valeur passée est un entier 
  {
    return (somme+'.0');
  }
} 
// Afficher date en ttes lettres
//   "      poids fichier original ou somme occupee sur le serveur
function display_image_properties(imageIndex, couche, modele)
{
  couche.hide();
  if(document.choix.ImageTITRE)content.hide();
  imageData = imagesData[imageIndex];
  imageWidth=imageData[11].split(';')[0];
  imageHeight=imageData[11].split(';')[1];
  if(document.choix.ImageID) document.choix.ImageID.value=imageData[0];

  //prendre en compte l'acces de l'album
  //imageLien = modele=='cadre'?'':"href=\"index.php?SiteID={SITE_ID}&PageID=43&ImageID="+imageData[0]+"\" target=_new";
  dims = imageData[12].split(';'); // ici on prend lowdim, a terme prendre vigndim
  dims = resize(dims[0], dims[1], 70);
  //imageLien = modele=='cadre'?'':"href=\"javascript:affiche("+imageData[1]+");\"";
  imageLien = page_id == 56?"href=\"index.php?SiteID="+site_id+"&PageID=43&ImageID="+imageData[0]+"\" target=_new":"href=\"javascript:affiche("+imageData[1]+", 0);\"";
  imageUrl  = "<a "+imageLien+"><img src="+imageData[9]+" border=0 width="+dims[0]+" height="+dims[1]+" onload=\""+couche.name+".show();"+(document.choix.ImageTITRE?'content.show();':'')+"\"></a>";
  cadre = replace( replace(photo_cadre, '[imageLien]', imageLien), '[imageUrl]', imageUrl);

/*
	  if (changestatus)  
	  {
	    num=ImageLIST.options[ImageLIST.selectedIndex].value;
      	ImageTITRE.value=unescape(titre[num]);
      	ImageAUTEUR.value=unescape(auteur[num]);
      	ImageDESCRIPTION.value=unescape(description[num]);//resultat[4].replace(/<br>/g,'\n');;
	  }
      chaine1='<table border=0 cellspacing=5 cellpadding=0><tr><td rowspan=2><table border="0" cellspacing="0" cellpadding="0"><tr><td colspan=3><img src="/yamafoto/html/default/images/border_top.gif"></td></tr><tr><td bgcolor="#990033" width=2 background=/yamafoto/html/default/images/border_left.gif></td><td align=center bgcolor=#ffff99 height=70 width=70><a href="javascript:popup(\'popimage\',\''+url2[num]+'\','+(parseInt(dimensionslow[num].split(';')[0])+40)+','+(parseInt(dimensionslow[num].split(';')[1])+50)+',1);"><img src="'+url[num]+'" border=0></a></td><td bgcolor="#990033" width=2 background=/yamafoto/html/default/images/border_right.gif></td></tr><tr><td colspan=3><img src="/yamafoto/html/default/images/border_bottom.gif"></td></tr></table></td><td class=t-p colspan=2>Date de mise en ligne<br><span class=formtext>'+date[num]+'</span></td></tr><tr><td class=t-p>Poids<!-- du fichier--><br><span id=formtext2>'+(Math.round(size[num]/100)/10)+' Ko</span></td><td class=t-p>Taille (pixels)<!-- de l\'image--><br><span id=formtext2>'+width+'x'+height+'</span></td></tr>';	
*/
	
	if(modele=='cadre') chaine = cadre; else{

    width = page_id == 49?365:283;
	width = '100%';
	chaine = '<div class="form-content"><div class="clearfix"><div class="l" style="width:76px;">'+cadre+'</div>'+
	'<div class="clearfix l" style="text-align:left;height:74px;margin-left:3px;">'+
	'<p>Date de mise en ligne</p>'+
	'<p class="prop-image" style="width:187px;">'+imageData[6]+'</p>'+
	'<p class="l" style="width:88px;">Taille</p><p class="l" style="margin-left:3px;width:89px;">Dimensions</p><br />'+	
	'<p class="prop-image l" style="width:88px;">'+certify(Math.round(imageData[10]/100)/10+Math.round(imageData[15]/100)/10+Math.round(imageData[16]/100)/10)+' Ko</p>'+
    '<p class="prop-image l" style="margin-left:3px;width:89px;">'+imageWidth+'x'+imageHeight+'</p>'+			
	'</div></div>';
	
	/*
utiliser template pour creer cet objet et diaply:none/inline pour afficher ou pas les div

dimens. (pixels)

		
*/
	  if(!document.choix.ImageTITRE){
		chaine += '<span>Titre</span><br /><p class="prop-image">'+imageData[3]+'</p><br>';
 	    if(imageData[4]!='')	chaine += '<p>Auteur</p><p class="prop-image">'+imageData[4]+'</p>';
	    if(imageData[5]!='') chaine += '<p>Description</p><p class="prop-image">'+imageData[5]+'</p>';
	  }else{
	    document.choix.ImageTITRE.value = imageData[3];
	    document.choix.ImageAUTEUR.value = imageData[4];	
	    document.choix.ImageDESCRIPTION.value = imageData[5];	  
	  }
	  chaine += '</div>';
	  }
	  couche.write(replace(cadre_image_properties, '[content]', chaine));
	  // On force l'affichage du layer au bout d'un certain temp car parfois le onload n'est pas pris en compte (ex: opera sur guestbook ecrire)
	  setTimeout(couche.name+'.show()', 500);
	  if(document.choix.ImageTITRE) setTimeout('content.show()', 500);
}

