
function varreIMG(){

var maxWidth=650; // Largura maxima da miniatura
var maxHeight=120; // Altura mxima da miniatura

var maxWidth2=170; // Largura maxima da miniatura
var maxHeight2=110; // Altura mxima da miniatura

var img = document.getElementsByTagName("img");

for (i=0;i<img.length;i++){

  //alert(img);

  if (img[i].alt == "yes" && img[i].id =="1") {

  var width=img[i].width;
  var height=img[i].height;
  

  
  if ((width == maxWidth && height == maxHeight)) {
     newWidth = maxWidth;
     newHeight = maxHeight;
   }
  if ((width > maxWidth && height == maxHeight)) {
     newWidth = maxWidth;
     newHeight= height;
   }
   if ((width > maxWidth && height > maxHeight)) {
     newWidth = maxWidth;
     newHeight= maxHeight;
  }
   if ((width > maxWidth && height <= maxHeight)) {
     newWidth = maxWidth;
     newHeight= height;
  }
   if ((width < maxWidth && height >= maxHeight)) {
     newWidth = width;
     newHeight= maxHeight;
  }
    if ((width < maxWidth && height < maxHeight)) {
     newWidth = width;
     newHeight= height;
  }

    img[i].width=Math.round(newWidth);
    img[i].height=Math.round(newHeight);
    img[i].style.display="block";

  }

   if (img[i].alt == "yes" && img[i].id =="2") {

  var width=img[i].width;
  var height=img[i].height;

  //alert("W:"+width+" H:"+height);


  if (width >= maxWidth2) {
     newWidth = maxWidth2;
     newHeight= height;

   }

   if (width >= maxWidth2) {
     newWidth = maxWidth2;
     newHeight= height;

   }

    if (width < maxWidth2) {
     newWidth = width;
     newHeight= height;
       // alert("6 W:"+width+" H:"+height);

   }

    img[i].width=Math.round(newWidth);
    img[i].height=Math.round(newHeight);
    img[i].style.display="block";

  }
  
  
  
  
  }
  }


