/*
 * jQuery Plugin: Image Captions
 *
 * Add captions (the image title) below each matching image.
 */

$.fn.image_captions = function(options){

	var defaults = {
		caption_class: 'cms-caption'
	};

	var options = $.extend(defaults, options);	

	$(this).each(function() {
		title = $(this).attr('title');
		$(this).removeAttr('title');
		if (title != '' && title != null) {
			wrap_div = $('<div>');
			wrap_div.attr('class', $(this).attr('class'));
			$(this).wrap(wrap_div);
			$(this).after('<p class="' + options.caption_class + '">' + title + '</p>');
			$(this).removeAttr('class','');
		}
	})
	
	
}
