function AfficheImage(petiteImage,grandeImage,texteImage)
{
document.write('<a href="javascript:Affichegrande(\''+grandeImage+'\',\''+texteImage+'\')"><img src="'+petiteImage+'" alt="cliquez ici pour afficher en grand" /></a>');
document.write('<img src="'+ grandeImage +'" style="display:none" alt="" />');
} 
function Affichegrande(cheminImage,texte)
{
  // Cette function recoit 3 parametres
  // inImg : Chemin relatif de l'image
  // inMW  : Largeur maximale
  // inMH   : Hauteur maximale
  var maxWidth = screen.width;
  var maxHeight = screen.height - 100;
  // Declarations des variables "Nouvelle Taille"
  var dW = 0;
  var dH = 0;
  // Declaration d'un objet Image
  var oImg = new Image();
  // Affectation du chemin de l'image a l'objet
  oImg.src = cheminImage;
  // On recupere les tailles reelles
  var h = dH = oImg.height;
  var w = dW = oImg.width;
  // Si la largeur ou la hauteur depasse la taille maximale
  if ((h >= maxHeight) || (w >= maxWidth)) {
    // Si la largeur et la hauteur depasse la taille maximale
    if ((h >= maxHeight) && (w >= maxWidth)) {
      // On cherche la plus grande valeur
      if (h > w) {
        dH = maxHeight;
        // On recalcule la taille proportionnellement
        dW = parseInt((w * dH) / h, 10);
      } else {
        dW = maxWidth;
        // On recalcule la taille proportionnellement
        dH = parseInt((h * dW) / w, 10);
      }
    } else if ((h > maxHeight) && (w < maxWidth)) {
      // Si la hauteur depasse la taille maximale
      dH = maxHeight;
        // On recalcule la taille proportionnellement
      dW = parseInt((w * dH) / h, 10);
    } else if ((h < maxHeight) && (w > maxWidth)) {
      // Si la largeur depasse la taille maximale
      dW = maxWidth;
        // On recalcule la taille proportionnellement
      dH = parseInt((h * dW) / w, 10);
    }
  }

var fW = 0;
var fH = 0;
if (dW > dH) {
	fH = (dH + 30);
	fW = parseInt((((dW * fH) / dH) - 10), 10);
}
else {
	fW = (dW + 30);
	fH = parseInt((((dH * fW) / dW) + 10), 10);
}

var posLeft = ((screen.width) - fW)/2;
var posTop = ((screen.height) - fH)/2;

thePHPWindow = '#' + '&imageName=' + cheminImage + texte + '&imageHeight='+ dH + '&imageWidth=' + dW + '&scrWidth=' + fW + '&scrHeight=' + fH ;
	newWindow = window.open(thePHPWindow,"newWindow", "width="+fW+",height="+fH+",left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>www.verticaltitude.new.fr</title><body leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" bgcolor="#000000" onBlur="self.close()" onClick="self.close()">');  
	newWindow.document.write('<table width='+ dW +' border="0" cellspacing="0" cellpadding="0" align="center" valign="center" height='+ dH +' ><br /><tr><td>');
	newWindow.document.write('<img src="'+ cheminImage +'" width='+ dW +' height='+ dH +' alt="'+ texte +'" title="'+ texte +'" name="monImage" />'); 
	newWindow.document.write('</td></tr></table></body></html>');
	newWindow.document.close();
	newWindow.focus();
}
