$(document).ready(function() {
	//resize attachmentbox to same width as postbody, looks nicer
	$('.attachbox').each(function() {
		//console.log($(this).width());
                //console.log($('div.postbody').width());
		if($(this).width() > $('div.postbody').width()) {
			//console.log($(this));
			$(this).width($('div.postbody').width());
			$(this).css('width', $('div.postbody').width());
			$(this).css('max-width', $('div.postbody').width());
		}
	});
	$('.attach-image > img').each(function() {
		var file = $(this).parent().parent();
		var temp = $(file[0].children[1]);
		var title = $(file[0].children[1]).html();
		if($(temp).children().length > 1) {
			title = $(temp[0].children[0]).html();
		}
		$(this).removeAttr('onclick');
		$(this).colorbox({href:$(this).attr('src'),photo:true,maxHeight:'95%',title:title});
	});
	
	
});

