
// this is called when you click on an image with the auto-width class,
// we want to pop it up in a new window
function popupFullSize(domNode) {
	window.open(domNode.src);
}

// This goes through and resizes all of the images with the auto-width class
// so that they're just as wide as the screen.
jQuery(function($) {

	var pageWidth = ($("#posts").width() - 40);

	$(".auto-width").each(function() {
		var me = $(this);
		if (me.width() > pageWidth) {
			var height = (me.height() / me.width()) * pageWidth;

			me.css("width", pageWidth + "px");
			me.css("height", height + "px");
			me.css("cursor", "pointer");
			me.click(function() {
				popupFullSize(this);
			});
		}
	});

});

