$(document).ready(function() {
	if ($('.gallery').html() != null) {
		if ($('.gallery').find('a > img').html() == null) {
			$('.gallery img').each(function(index) {
				var source = $(this).attr("src").replace(/_t\./, '.');
				var title = $(this).attr("title");
				$(this).wrap('<a href="'+source+'" title="'+title+'">');
			})
		}
	}
});

