var wrap_images_in_links = function () {
	$("div.post img").wrap("<a class='img_fix'></a>");
	$("a.img_fix").each( function() {
		$(this).attr("href", $(this).find("img").get(0).src);
		$(this).parent().replaceWith($(this));
	});
}

$(document).ready(function() {

	jQuery.fn.log = function (msg) {
		console.log("%s: %o", msg, this);
		return this;
	};

	wrap_images_in_links();
});

