// jQuery image loader
// @author: Johan Gärderud, jg@garderud.net
(function($) {
  	$.fn.imageLoader = function(params) {
		return this.each(function(){
			$(this).hide();
			var $this = $(this);
			var img = new Image();
			var src = $(this).attr('src');
			var w = $(this).css('width');
			var h = $(this).css('height');
			var parent = $(this).parent();		
			$(parent)
				.addClass('loading');
			$(img)
			.load(function () {
				$this.fadeIn('slow');
				$(parent).removeClass('loading');
				//$(parent).removeAttr('style');
			})
			.attr('src',src);
		});
  	};
})(jQuery);
$(function () {
	// this selector needs to be the image(s)
	// that are being loaded
	$('img.load').imageLoader();
});