(function($)
{
	$.fn.boxify = function(options)
	{
		var _options =
		{
		      color: 'yellow',
		      type: 'bottom'
	 	};

		return this.each(function()
		{
			options && $.extend(_options, options);

			var $this = $(this);

			$this.wrap(function()
			{
				return '<div class="box ' + _options.color + ' ' + _options.type + ($this.prev('.box').length ? ' consecutive' : '') +'"/>';
			});

			(_options.type == 'both' || _options.type == 'top') && $this.before('<div class="border top"></div>');
			(_options.type == 'both' || _options.type == 'bottom') && $this.after('<div class="border bottom"></div>');

			$this.css({ position: 'relative', zIndex: 1 });
		});
	}
})(jQuery);
