$(function() {
	$.fn.loadimage = function(image_url) { 
		var id = $(this).attr('id'); 
		var img = new Image();

		$(img).load(function () {  
			$(this).hide();

			$("#" + id).removeClass('loading').append(this);
			if (id=='background'){
				$("#" + id).removeClass('bigloading').css("background-image", "url('background_main.png')").css("background-repeat", "repeat-x");
				$(this).css('filter', 'alpha(opacity=10)').fadeIn();
			} else {
				$(this).css('max-width', '300px').css('max-height', '225px').css('filter', 'alpha(opacity=100)').fadeIn();
			}
			id = true;
		}).error(function () {
			$("<div id='error'>The image can't be loaded from " + image_url + "</div>").appendTo(this);
		}).attr('src', image_url);
	}
});
