$(document).ready(function() {
	$("#bodycontent img.captionT").each(function(counter,element) {
		if ( $(this).attr('align') == "right" )
			$(element).wrap("<div class=\"imageBorder\" style=\"float: right; width: " + $(this).attr('width') + "\"></div>");
		else if ( $(this).attr('align') == "left" )
			$(element).wrap("<div class=\"imageBorder\" style=\"float: left; width: " + $(this).attr('width') + "\"></div>");
		else
			$(element).wrap("<div class=\"imageBorder\" style=\"clear: both; width: " + $(this).attr('width') + "\"></div>");
		this.align = "";
		$(element).before( "<br />" + $(this).attr('alt') );
	});
	$("#bodycontent img.captionB").each(function(counter,element) {
		if ( $(this).attr('align') == "right" )
			$(element).wrap("<div class=\"imageBorder\" style=\"float: right; width: " + $(this).attr('width') + "\"></div>");
		else if ( $(this).attr('align') == "left" )
			$(element).wrap("<div class=\"imageBorder\" style=\"float: left; width: " + $(this).attr('width') + "\"></div>");
		else
			$(element).wrap("<div class=\"imageBorder\" style=\"clear: both; width: " + $(this).attr('width') + "\"></div>");
		this.align = "";
		$(element).after( "<br />" + $(this).attr('alt') );
	});
});
