(function($) {

	function readyhandle(img, size) {

		if(img.width > img.height && img.width > size.width) {
			$(this).attr('width', size.width);
		} 
		if(img.height > img.width && img.height > size.height) {
			$(this).attr('height', size.height);
		}
	};
	
	window.adjust = function(selector, size) {

		$(selector).each(function(index, el) {
			imgReady(el.src, function() {
			
				readyhandle.call(el, this, size);
			});
		});
	};

})(jQuery);
