Index: /CKEditor/branches/prototype/_source/core/resourcemanager.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/resourcemanager.js	(revision 2159)
+++ /CKEditor/branches/prototype/_source/core/resourcemanager.js	(revision 2160)
@@ -168,5 +168,4 @@
 		// Ensure that we have an Array of names.
 		var names = CKEDITOR.tools.isArray( name ) ? name : [ name ];
-
 		var total = names.length;
 
@@ -188,6 +187,29 @@
 		};
 
-		var loaded = this.loaded;
-		var waitingList = this._.waitingList;
+		var loaded = this.loaded,
+			waitingList = this._.waitingList;
+
+		var loadPlugin = function( name )
+		{
+			// Calculate the plugin script path.
+			var path = this.externals[ name ] || ( this.basePath + name + '/' );
+			var filePath = path + this.fileName + '.js';
+
+			// Load the plugin script.
+			CKEDITOR.scriptLoader.load( filePath, function( success )
+				{
+					if ( !success )
+						throw '[CKEDITOR.resourceManager.load] Resource name "' + name + '" was not found at "' + filePath + '".';
+
+					loaded[ name ] = path;
+
+					// Check all callbacks that were waiting for this
+					// resource.
+					for ( var j = 0 ; j < waitingInfo.length ; j++ )
+						loadCheck( waitingInfo[ j ] );
+
+					delete waitingList[ name ];
+				});
+		};
 
 		// Loop through all names.
@@ -204,30 +226,5 @@
 				// If this is the first call for it, go ahead loading.
 				if ( waitingInfo.length == 1 )
-				{
-					// Calculate the plugin script path.
-					var path = this.externals[ name ] || ( this.basePath + name + '/' );
-
-					// Putting it in a closure to avoid the variables used
-					// inside the CKEDITOR.scriptLoader.load closure to be
-					// changed in the loop.
-					(function( name, path, fileName )
-					{
-						// Load the plugin script.
-						CKEDITOR.scriptLoader.load( path + fileName + '.js', function( success )
-							{
-								if ( !success )
-									throw '[CKEDITOR.resourceManager.load] Resource name "' + name + '" was not found at "' + path + fileName + '.js".';
-
-								loaded[ name ] = path;
-
-								// Check all callbacks that were waiting for this
-								// resource.
-								for ( var j = 0 ; j < waitingInfo.length ; j++ )
-									loadCheck( waitingInfo[ j ] );
-
-								delete waitingList[ name ];
-							});
-					})( name, path, this.fileName );
-				}
+					loadPlugin.call( this, name );
 			}
 			else
