/**
 * jQuery plugin
 */
(function($){
	$.fn.extend({
		scrollBar : function(config) {
			var	defaultConfig = {
					 width : 200
					,height: 200
					,theme : 'scrollable-default-theme'
				}, target;
				
			// normalize config
			if (typeof(config) == 'object' && config != null)
			{
				config = $.extend(defaultConfig, config);
			} else {
				config = defaultConfig;
			}

			return this.each(function() {
				/* manipulation */
				$(this).wrap('<div class="scrollable-area '+ config.theme +'"/>')
					   .before('<div class="scroll-bar"><div class="scroll-handle"/></div>')
					   .wrap('<div class="scrollable-body"/>');
				
				target = $(this).parent().parent();
				
				target.height(config.height);
				target.width(config.width);
				//apply scrollable:
				new ScrollBar(target);
			});
		}
	});
})(jQuery);
