(function(a){
	a.fn.aeImageResize=function(c){
		var f="height",i="width",b=a.browser,e=Math.floor,g=a.extend({height:9,width:9},c),h=b.msie&&(parseInt(b.version)==6),d=g[i]/g[f];
		a(this).one("load",function(){
			a(this).removeAttr(f).removeAttr(i).css({height:"",width:""});
			var k=this[f],l=this[i],j=g[f],m=g[i],n=l/k;
			if(k>j||l>m){
				if(n>d){
				j=e(k/l*m)
			}else{
				m=e(l/k*j)
			}
			a(this).attr({height:j,width:m});
			a(this).trigger('yourEvent');}
			}).each(function(){
			if(this.complete||h){
			a(this).trigger("load")}
		})
	}
})(jQuery);
