steal('can/control', function(){
	


//used to determine if a controller instance is one of controllers
//controllers can be strings or classes
var i, 
isAControllerOf = function( instance, controllers ) {
	for ( i = 0; i < controllers.length; i++ ) {
		if ( typeof controllers[i] == 'string' ? instance.constructor._shortName == controllers[i] : instance instanceof controllers[i] ) {
			return true;
		}
	}
	return false;
},
data = function(el, data){
	var $el = can.$(el);
	$el.data("controllers", data || {})
	return $el.data('controllers');
},
makeArray = can.makeArray;


/**
 * @hide
 * @attribute pluginName
 * Setting the <code>pluginName</code> property allows you
 * to change the jQuery plugin helper name from its 
 * default value.
 * 
 *     can.Control("Mxui.Layout.Fill",{
 *       pluginName: "fillWith"
 *     },{});
 *     
 *     $("#foo").fillWith();
 */
can.prototype.extend({

	/**
	 * @function jQuery.fn.controllers
	 * @parent can.Control.plugin
	 * Gets all controllers in the jQuery element.
	 * @return {Array} an array of controller instances.
	 */
	controllers: function() {
		var controllerNames = makeArray(arguments),
			instances = [],
			controllers, c, cname;
		//check if arguments
		this.each(function() {

			controllers = can.$(this).data("controllers");
			for ( cname in controllers ) {
				if ( controllers.hasOwnProperty(cname) ) {
					c = controllers[cname];
					if (!controllerNames.length || isAControllerOf(c, controllerNames) ) {
						instances.push(c);
					}
				}
			}
		});
		return instances;
	},
	/**
	 * @function jQuery.fn.controller
	 * @parent can.Control.plugin
	 * Gets a controller in the jQuery element.  With no arguments, returns the first one found.
	 * @param {Object} controller (optional) if exists, the first controller instance with this class type will be returned.
	 * @return {jQuery.Controller} the first controller.
	 */
	controller: function( controller ) {
		return this.controllers.apply(this, arguments)[0];
	}
});

can.Control.plugin = function(pluginname){
	var controller = this;

	if (!can.prototype[pluginname]) {
		can.prototype[pluginname] = function(options){
		
			var args = makeArray(arguments),   //if the arg is a method on this controller
			isMethod = typeof options == "string" && $.isFunction(controller.prototype[options]), meth = args[0];
			return this.each(function(){
				//check if created
				var controllers = data(this),    //plugin is actually the controller instance
				plugin = controllers && controllers[pluginname];
				
				if (plugin) {
					if (isMethod) {
						// call a method on the controller with the remaining args
						plugin[meth].apply(plugin, args.slice(1));
					}
					else {
						// call the plugin's update method
						plugin.update.apply(plugin, args);
					}
					
				}
				else {
					//create a new controller instance
					controllers[pluginname] = 
						controller.newInstance.apply(controller, [this].concat(args));
				}
			});
		};
	}
}

});
@@ -145,16 +145,17 @@
 var i, %0A
+%09
 isAContr
@@ -200,16 +200,17 @@
 ers ) %7B%0A
+%09
 %09for ( i
@@ -247,16 +247,17 @@
 i++ ) %7B%0A
+%09
 %09%09if ( t
@@ -381,24 +381,25 @@
 s%5Bi%5D ) %7B%0A%09%09%09
+%09
 return true;
@@ -405,13 +405,16 @@
 ;%0A%09%09
+%09
 %7D%0A
+%09
 %09%7D%0A
+%09
 %09ret
@@ -424,19 +424,21 @@
  false;%0A
+%09
 %7D,%0A
+%09
 data = f
@@ -456,16 +456,17 @@
  data)%7B%0A
+%09
 %09var $el
@@ -479,16 +479,17 @@
 .$(el);%0A
+%09
 %09$el.dat
@@ -517,16 +517,17 @@
  %7C%7C %7B%7D)%0A
+%09
 %09return 
@@ -551,19 +551,21 @@
 lers');%0A
+%09
 %7D,%0A
+%09
 makeArra
@@ -581,18 +581,694 @@
 akeArray
+,%0A%09old = can.Control.setup;%0A%0A%0Acan.Control.setup = function() %7B%0A%09// if you didn't provide a name, or are control, don't do anything%0A%09if ( this !== can.Control ) %7B%0A%09%09/**%0A%09%09 * @hide%0A%09%09 * @attribute pluginName%0A%09%09 * Setting the %3Ccode%3EpluginName%3C/code%3E property allows you%0A%09%09 * to change the jQuery plugin helper name from its %0A%09%09 * default value.%0A%09%09 * %0A%09%09 *     can.Control(%22Mxui.Layout.Fill%22,%7B%0A%09%09 *       pluginName: %22fillWith%22%0A%09%09 *     %7D,%7B%7D);%0A%09%09 *     %0A%09%09 *     $(%22#foo%22).fillWith();%0A%09%09 */%0A%09%09var pluginName = this.pluginName %7C%7C this._fullName;%0A%09%09%09%0A%09%09// create jQuery plugin%0A%09%09if(pluginName !== 'can_control')%7B%0A%09%09%09this.plugin(pluginName);%0A%09%09%7D%0A%09%09%09%0A%09%09old.apply(this, arguments);%0A%09%7D%0A%7D
 ;
-%0A
 %0A%0A/**%0A *

fix for refactor in control not calling plugin anymore