/* Presentation Engine Utility Functions */
/* Function:    resizer
   Description: Sets and image element with src and resized width and height preserving 
                aspect Ratio  
*/
function resizer(thisImage,maxWidth,maxHeight) 
   { 
     var aspect_ratio,width,height;
     
         thisImage.style.display = "inline";
         
         if (maxHeight == 0)
         {
           maxHeight = 100000;
         }
	 
	 aspect_ratio = thisImage.width / thisImage.height;
	 
	 if ((thisImage.width > maxWidth) || thisImage.height > maxHeight)
	 {
		 if (aspect_ratio <= 1)
		 {
		   thisImage.width = maxHeight * aspect_ratio; 
		   thisImage.height = maxHeight;
		   
		   if (thisImage.width > maxWidth) 
		   {
		     thisImage.height = maxWidth * (1 / aspect_ratio);
		     thisImage.width = maxWidth;
		   }
		   
		 }
		 else 
		 {  
		   thisImage.height = maxWidth * (1 / aspect_ratio);
		   thisImage.width = maxWidth;
		   
		   
		   if (thisImage.height > maxHeight)
		   {
		     thisImage.width = maxHeight * aspect_ratio; 
		   thisImage.height = maxHeight;
		   }
		   
		 }
	 }
    
   }