(function($){
			$.fn.scaleMe = function(params){
 
				// Paramètres
				var params = $.extend({
					w: 50,
					h: 40
				},params);
 
				return this.css("position", "relative").each(function(){
					//move( $(this) );
					iH = $(this).outerHeight();
					iW = $(this).outerWidth();
					
					
					
					echelleW = params.w / iW;
					echelleH = params.h / iH;
					
					if(echelleW >= echelleH ) {
						echelle = echelleW;
					} else {
						echelle = echelleH;
					}
					
					
					src = $(this).attr("src");
					
					newW = iW * echelle;
					newH = iH * echelle;
					
					maClass = " class = '" + $(this).attr("class") + "'";
					
					style="style=\"overflow:hidden; width: "+params.w+"px; height: "+params.h+"px; background-image:url("+src+");    \"";
					
					marginLeft = "";
					marginTop = "";
					
					if(newW > params.w) {
						moveW = (newW - params.w) / 2;
						marginLeft = "margin-left: -"+moveW+"px; ";
					}
					
					if(newH > params.h) {
						moveH = (newH - params.h) / 2;
						marginTop = "margin-top: -"+moveH+"px; ";
					}
					
					image = "<img src='"+src+"' height='"+newH+"' width='"+newW+"' style='"+marginLeft+" "+marginTop+"'>";
					rand = Math.floor(Math.random()*10000);
										
					$("#image"+rand + " img").css("border","1px red solid");
					
					$("<div "+style+" "+maClass+" id='image"+rand+"'>"+image+"</div>").insertBefore($(this));
					
					$("#image"+rand).fadeIn();
					
					
					
				});
			};
		})(jQuery)
