function resizeImages(iMaxX, iMaxY){
	alert('resizing');
   maxSize = 80;

   for (x=0;x<document.images.length;x++){
 		alert('document.images[x].height.className:' + document.images[x].height.className);
      iHeight = document.images[x].height;
      iWidth = document.images[x].width;

      if (iHeight > iWidth){
         sizeGuide = iHeight;
         size2 = iWidth;
      }else{
         sizeGuide = iWidth;
         size2 = iHeight;
      }


      if (sizeGuide > maxSize){

         sizeRatio = sizeGuide / size2;
         newSize1 = maxSize;
         newSize2 = newSize1 / sizeRatio;

         if (iHeight > iWidth){
            document.images[x].height = newSize1;
            document.images[x].width = newSize2;
         }else{
            document.images[x].width = newSize1;
            document.images[x].height = newSize2;
         }
      }
   }
}

function findimg(strClass, iMaxX, iMaxY)
{
 var is_chrome = navigator.userAgent.toLowerCase().indexOf('chrome') > -1;
 var imgs,i;
 var iHeight, iWidth;
 //imgs=document.getElementsByTagName('img');
 imgs = dojo.query("."+strClass);
 //alert('Aantal img: ' + imgs.length);
 //for(i in imgs)
 for(i=0;i<imgs.length;i++)
  {
	  if (imgs[i]){
	  	//adjustRatio( imgs[i] );
 
  			//Schalen
	  		var divideY = iMaxY/imgs[i].height;
	  		var divideX = iMaxX/imgs[i].width;
	  		iHeight = imgs[i].height;
	  		if (iHeight == 0) {
	  			if (!is_chrome) {
	  				iHeight = imgs[i].height();
	  			}
	  		}
	  		iWidth = imgs[i].width;
	  		if (iWidth == 0) {
	  			if (!is_chrome) { 
	  				iWidth = imgs[i].width();
	  			}
	  		}
	  		debugger;
	  		//Breder en hoger
	  		if (imgs[i].height > iMaxY && imgs[i].width > iMaxX){
	  			//afhankelijk van de grootste schaling, schalen.
	  			if (divideY < divideX) {
	  				//alert('height 1: '+imgs[i].height+' -> width 1: '+imgs[i].width); 
	  				imgs[i].height = iMaxY;
	  				imgs[i].width = 'auto';
	  			} else {
	  				//alert('width 1: '+imgs[i].width+' -> height 1: '+imgs[i].height);
	  				imgs[i].width = iMaxX;
	  				imgs[i].height = 'auto'
	  			}
	  		} else {
	  		//Breder en niet hoger
	  		if (imgs[i].height > iMaxY){
	  			//alert('height 2: '+imgs[i].height);
  				imgs[i].height = iMaxY;
  				imgs[i].width = 'auto';
  			}
	  		//Niet breder, wel hoger
	  		if (imgs[i].width > iMaxX){
	  			//alert('width 2: '+imgs[i].width);
  				imgs[i].width = iMaxX;
  				imgs[i].height = 'auto';
  			}
  			}
		}  else {

		}
	
  }
}

function adjustRatio(img){
    if(window.innerHeight < img.height)
    {
        img.style.height = '100%';
        img.style.width = 'auto';
    }
    else if(window.innerWidth < img.width)
    {
        img.style.width = '100%';
        img.style.height = 'auto';
    }
}

function refreshStyle(strClass){
	var byStyle = dojo.query("."+strClass);
	debugger;
	for(i=0;i<byStyle.length;i++)
	{
		if (byStyle[i]){
			a = byStyle[i];
			if( a.style )
			{
				a.style.disabled = true;
				a.style.disabled = false;
			}
		}
	}

}
