+FilmSlider.prototype.shrinkImage = function(img) {
+ var dispWidth = parseInt(this.stretchable.style.width);
+ var imgWidth = img.width;
+ var dispHeight = parseInt(this.stretchable.style.height);
+ var imgHeight = img.height;
+ var ratio;
+
+ if (imgHeight > dispHeight) {
+ ratio = dispHeight / imgHeight;
+ imgWidth = imgWidth * ratio;
+ imgHeight = dispHeight;
+ }
+ if (imgWidth > dispWidth) {
+ ratio = dispWidth / imgWidth;
+ imgHeight = imgHeight * ratio;
+ imgWidth = dispWidth;
+ }
+ img.width = imgWidth;
+ img.height = imgHeight;
+};
+