<!--
var v;
function resizeImage(inImg, inMW, inMH)
{
  // Cette function recoit 3 parametres
  // inImg : Chemin relatif de l'image
  // inMW  : Largeur maximale
  // inMH   : Hauteur maximale
  var maxWidth = inMW;
  var maxHeight = inMH;
  // 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 = inImg;
  if (oImg.complete == true) {
    clearTimeout(v);
    // On recupere les tailles reelles
    var h = dH = oImg.height;
    var w = dW = oImg.width;
    oImg.src = inImg;
    // On recupere les tailles reelles
    h = dH = oImg.height;
    w = dW = oImg.width;
    var hRatio = maxWidth / w;
    var vRatio = maxHeight / h;
    if (hRatio >= vRatio) {
      dH = parseInt(h * vRatio, 10);
      dW = parseInt(w * vRatio, 10);
    } else {
      dH = parseInt(h * hRatio, 10);
      dW = parseInt(w * hRatio, 10);
    }
    
    // On ecrit l'image dans le document

    document.getElementById('tdPhoto').innerHTML = "<img class=\"imageChapo\" src=\"" + inImg + "\" style=\"width:" + dW + "px; height: "+ dH + "px\"/>";
    /*document.writeln("<img class=\"imageChapo\" src=\"" + inImg + "\" style=\"width:" + dW + "px; height: "+ dH + "px\"/>");*/
  } else {
    v = setTimeout('resizeImage("'+inImg+'",'+inMW+', '+inMH+')', 100);
  }
   
};

  function resizeImageBigger(src, maxWidth, maxHeight, idContainer) {
  var image = new Image();
  image.src = src;
  image.onload = function() {
    var ratio = this.width / this.height;
    if (this.width > maxWidth) {
      this.width = maxWidth;
      this.height = parseInt(maxWidth / ratio);
    } else if (this.height > maxHeight) {
      this.width = parseInt(maxHeight * ratio);
      this.height = maxHeight;
    }
    document.getElementById(idContainer).appendChild(this);
  };
}

function resizeImageForList(inImg, inMW, inMH, elementName)
{
  // Cette function recoit 4 parametres
  // inImg : Chemin relatif de l'image
  // inMW  : Largeur maximale
  // inMH   : Hauteur maximale
  // elementName : le nom de l'élèment ou écrire l'image. il doit être différent pour chaque logo de la liste.
  var maxWidth = inMW;
  var maxHeight = inMH;
  // 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 = inImg;
  if (oImg.complete == true) {
    clearTimeout(v);
    // On recupere les tailles reelles
    var h = dH = oImg.height;
    var w = dW = oImg.width;
    oImg.src = inImg;
    // On recupere les tailles reelles
    h = dH = oImg.height;
    w = dW = oImg.width;
    var hRatio = maxWidth / w;
    var vRatio = maxHeight / h;
    if (hRatio >= vRatio) {
      dH = parseInt(h * vRatio, 10);
      dW = parseInt(w * vRatio, 10);
    } else {
      dH = parseInt(h * hRatio, 10);
      dW = parseInt(w * hRatio, 10);
    }
    
    // On ecrit l'image dans le document

    document.getElementById(elementName).innerHTML = "<img class=\"imageChapo\" src=\"" + inImg + "\" style=\"width:" + dW + "px; height: "+ dH + "px\"/>";
    /*document.writeln("<img class=\"imageChapo\" src=\"" + inImg + "\" style=\"width:" + dW + "px; height: "+ dH + "px\"/>");*/
  } else {
    v = setTimeout('resizeImage("'+inImg+'",'+inMW+', '+inMH+')', 100);
  }
   
};


//-->
