why doesn't this js work in ie9?
Seems to work on other browsers - is there something that needs to be done differently in ie9?  

It resizes an image automatically when a window resizes
  

     $(document).ready(function() {
            	var $img = $("#theImage");
            	var ratio;
            	var offsetX = $img.offset().left;
            	var offsetY = $img.offset().top;
            	
            	$(window).load(function () {
            		ratio = $img.width() / $img.height();
            		$(this).resize();
            	});
            	
            	$(window).resize(function () {
            		var viewportWidth = window.innerWidth || document.documentElement.clientWidth;
            		var viewportHeight = window.innerHeight || document.documentElement.clientHeight;
            		var availWidth = viewportWidth - offsetX - 25;
            		var availHeight = viewportHeight - offsetY - 25;
            		
            		if (availWidth / availHeight > ratio) {
            			$img.height(availHeight);
            			$img.width(availHeight * ratio);
            		} else {
            			$img.width(availWidth);
            			$img.height(availWidth / ratio);
            		}
            	});
            });
why doesn't this js work in ie9?
===

Seems to work on other browsers - is there something that needs to be done differently in ie9?  

It resizes an image automatically when a window resizes
  

     $(document).ready(function() {
            	var $img = $("#theImage");
            	var ratio;
            	var offsetX = $img.offset().left;
            	var offsetY = $img.offset().top;
            	
            	$(window).load(function () {
            		ratio = $img.width() / $img.height();
            		$(this).resize();
            	});
            	
            	$(window).resize(function () {
            		var viewportWidth = window.innerWidth || document.documentElement.clientWidth;
            		var viewportHeight = window.innerHeight || document.documentElement.clientHeight;
            		var availWidth = viewportWidth - offsetX - 25;
            		var availHeight = viewportHeight - offsetY - 25;
            		
            		if (availWidth / availHeight > ratio) {
            			$img.height(availHeight);
            			$img.width(availHeight * ratio);
            		} else {
            			$img.width(availWidth);
            			$img.height(availWidth / ratio);
            		}
            	});
            });