/*
* Scaling by Mai-Web, Maico Pijnen
 */

(function ($) {
$.fn.extend({
	imageScale: function (settings) {
		var processImage = 
			function () 
			{
				if ($(this).is('img')) 
				{
					$(this).load(function () {	
						var width = $(this).width();
						var height = $(this).height();
						if (width > settings.width) 
						{
							//Set variables	for manipulation
							$(this).width(settings.width);
						}	
						$(this).css('visibility', 'visible');
					});
					var width = $(this).width();
					var height = $(this).height();
					if (width > settings.width) 
					{
						//Set variables	for manipulation

						$(this).width(settings.width);
					}	
					$(this).css('visibility', 'visible');
				}
			}
		
		return $(this).each(processImage);	

	}
});
})(jQuery);