+FilmSlider.prototype.adjustImage = function(img) {
+ var dispWidth = parseInt(this.stretchable.style.width, 10);
+ var imgWidth = img.naturalWidth;
+ var dispHeight = parseInt(this.stretchable.style.height, 10);
+ var imgHeight = img.naturalHeight;
+ 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;
+};
+