// <![CDATA[

$(document).ready(function(){
	//insertAfterCaption();
	appendCaption();
	//afterCaption();
});

/*****************/


this.appendCaption = function(){
	$("#article img").each(function () {
	var imgwidth = $(this).width();
	var title = $(this).attr("alt");
	
	$(this).wrap("<div class=\"image_container\"></div>");
	$(this).parent().css({
		width: imgwidth
		});
	$(this).parent().append("<div class=\"image_description\">" + title + "</div>").css({
		color: '#666666',
		fontSize: '11px',
		margin: '0px 0px 0px 0px',
		fontStyle: 'italic',
		fontWeight: 'normal',
		clear: 'both',
		width: imgwidth
		});
	
	});
}

this.insertAfterCaption = function(){
	$("#article img").each(function () {
	var imgwidth = $(this).width();
	var title = $(this).attr("title");
	var alt = $(this).attr("alt");
	alert(imgwidth);
	
	$("<div class='image_description'>"+"<span class='image_title'>"+ title +"</span>"+"<span class='image_alt'>"+ alt +"</span>"+"</div>").insertAfter(this);
	$('.image_description').css({
		color: '#666666',
		fontSize: '11px',
		margin: '0px 0px 0px 0px',
		clear: 'both',
		width: imgwidth
		});
	
	$('.image_title').css({
		fontStyle: 'italic'
		});
	
	});
}


this.afterCaption = function(){
	$("#article img").each(function () {
	var $this = $(this);
	var imgwidth = $this.width();
	var title = $this.attr("alt");
	
    var title = $this.attr("alt");
    $this.after('<div class="image_description">'+ title +'</div>');

	$('.image_description').css({
		margin: '0px 0px 0px 0px',
		width: imgwidth
		});
	
	});
}

/*****************/

// ]]>