Index: /CKEditor/branches/prototype/_source/core/ckeditor.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/ckeditor.js	(revision 2152)
+++ /CKEditor/branches/prototype/_source/core/ckeditor.js	(revision 2153)
@@ -73,7 +73,5 @@
 };
 
-// Set the status to "loading", which means that the main CKEDITOR object has
-// been created, and the rest is getting loaded.
-CKEDITOR.status = 'loading';
+CKEDITOR.status = 'loaded';
 
 // Load the bootstrap script.
Index: /CKEditor/branches/prototype/_source/core/ckeditor_base.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/ckeditor_base.js	(revision 2152)
+++ /CKEditor/branches/prototype/_source/core/ckeditor_base.js	(revision 2153)
@@ -29,5 +29,5 @@
 // ckeditor.js and ckeditor_basic.js files.
 
-// if (!window.CKEDITOR){window.CKEDITOR=(function(){return {_:{},status:'unloaded',basePath:(function(){var A='';var B=document.getElementsByTagName('script');for (var i=0;i<B.length;i++){var C=B[i].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?.js(?:\?.*)?$/i);if (C){A=C[1];break;}};if (A.indexOf('://')==-1){if (A.indexOf('/')==0) A=location.href.match(/^.*?:\/\/[^\/]*/)[0]+A;else A=location.href.match(/^[^\?]*\//)[0]+A;};return A;})()};})();};
+// if (!window.CKEDITOR){window.CKEDITOR=(function(){var A={_:{},status:'unloaded',basePath:(function(){var B='';var C=document.getElementsByTagName('script');for (var i=0;i<C.length;i++){var D=C[i].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?.js(?:\?.*)?$/i);if (D){B=D[1];break;}};if (B.indexOf('://')==-1){if (B.indexOf('/')===0) B=location.href.match(/^.*?:\/\/[^\/]*/)[0]+B;else B=location.href.match(/^[^\?]*\//)[0]+B;};return B;})()};A.scriptsPath=A.basePath+'_source/';return A;})();};
 
 // #### Raw code
@@ -44,6 +44,7 @@
 	window.CKEDITOR = (function()
 	{
+		var CKEDITOR =
 		/** @lends CKEDITOR */
-		return {
+		{
 			/**
 			 * Private object used to hold core stuff. It should not be used out of
@@ -113,4 +114,8 @@
 			})()
 		};
+
+		CKEDITOR.scriptsPath = CKEDITOR.basePath + '_source/';
+
+		return CKEDITOR;
 	})();
 }
Index: /CKEditor/branches/prototype/_source/core/ckeditor_basic.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/ckeditor_basic.js	(revision 2152)
+++ /CKEditor/branches/prototype/_source/core/ckeditor_basic.js	(revision 2153)
@@ -41,6 +41,4 @@
 {
 	delete CKEDITOR.loadFullCore;
-
-	CKEDITOR.loadFullCore._loaded = true;
 
 	var script = document.createElement( 'script' );
@@ -199,8 +197,11 @@
 				CKEDITOR.replaceAll( CKEDITOR.replaceClass );
 
-			if ( CKEDITOR.replace._pending && CKEDITOR.status == 'basic_loaded' && CKEDITOR.loadFullCore )
-				CKEDITOR.loadFullCore();
-
-			CKEDITOR.status = 'basic_ready';
+			if ( CKEDITOR.status == 'basic_loaded' )
+			{
+				if ( CKEDITOR.replace._pending && CKEDITOR.loadFullCore )
+					CKEDITOR.loadFullCore();
+
+				CKEDITOR.status = 'basic_ready';
+			}
 		};
 
Index: /CKEditor/branches/prototype/_source/core/editor.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/editor.js	(revision 2152)
+++ /CKEditor/branches/prototype/_source/core/editor.js	(revision 2153)
@@ -44,5 +44,5 @@
 	var getNewName = function()
 	{
-		var name = 'editor' + nameCounter++;
+		var name = 'editor' + ++nameCounter;
 		return CKEDITOR.instances[ name ] ? getNewName() : name;
 	};
Index: /CKEditor/branches/prototype/_source/core/loader.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/loader.js	(revision 2152)
+++ /CKEditor/branches/prototype/_source/core/loader.js	(revision 2153)
@@ -71,5 +71,5 @@
 		for ( var i = 0 ; i < scripts.length ; i++ )
 		{
-			var match = scripts[i].src.match( /(^|.*[\\\/])_source\/core\/loader.js(?:\?.*)?$/i );
+			var match = scripts[i].src.match( /(^|.*[\\\/])core\/loader.js(?:\?.*)?$/i );
 
 			if ( match )
Index: /CKEditor/branches/prototype/_source/core/plugins.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/plugins.js	(revision 2152)
+++ /CKEditor/branches/prototype/_source/core/plugins.js	(revision 2153)
@@ -31,3 +31,3 @@
  * @example
  */
-CKEDITOR.plugins = new CKEDITOR.resourceManager( CKEDITOR.basePath + '_source/plugins/', 'plugin' );
+CKEDITOR.plugins = new CKEDITOR.resourceManager( CKEDITOR.scriptsPath + 'plugins/', 'plugin' );
Index: /CKEditor/branches/prototype/_source/core/themes.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/themes.js	(revision 2152)
+++ /CKEditor/branches/prototype/_source/core/themes.js	(revision 2153)
@@ -31,3 +31,3 @@
  * @example
  */
-CKEDITOR.themes = new CKEDITOR.resourceManager( CKEDITOR.basePath + '_source/themes/', 'theme' );
+CKEDITOR.themes = new CKEDITOR.resourceManager( CKEDITOR.scriptsPath + 'themes/', 'theme' );
Index: /CKEditor/branches/prototype/_source/tests/core/ckeditor.html
===================================================================
--- /CKEditor/branches/prototype/_source/tests/core/ckeditor.html	(revision 2152)
+++ /CKEditor/branches/prototype/_source/tests/core/ckeditor.html	(revision 2153)
@@ -15,4 +15,16 @@
 
 	return {
+		test_replaceClass : function()
+		{
+			// Asserts the default value.
+			assert.areSame( 'ckeditor', CKEDITOR.replaceClass );
+		},
+
+		test_replaceByClassEnabled : function()
+		{
+			// Asserts the default value.
+			assert.isTrue( CKEDITOR.replaceByClassEnabled );
+		},
+
 		test_replaceId : function()
 		{
@@ -102,4 +114,16 @@
 		},
 
+		test_add : function()
+		{
+			var textarea = CKEDITOR.dom.element.createFromHtml( '<textarea id="test_add">&lt;p&gt;test_add&lt;/p&gt;<\/textarea>' );
+			textarea.appendTo( new CKEDITOR.dom.element( document.body ) );
+
+			var editor = new CKEDITOR.editor( textarea );
+
+			CKEDITOR.add( editor );
+
+			assert.areSame( editor, CKEDITOR.instances.test_add );
+		},
+
 		name : document.title
 	};
Index: /CKEditor/branches/prototype/_source/tests/core/ckeditor2.html
===================================================================
--- /CKEditor/branches/prototype/_source/tests/core/ckeditor2.html	(revision 2153)
+++ /CKEditor/branches/prototype/_source/tests/core/ckeditor2.html	(revision 2153)
@@ -0,0 +1,45 @@
+﻿<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml">
+<head>
+	<title>CKEDITOR 2</title>
+	<link rel="stylesheet" type="text/css" href="../test.css" />
+	<script type="text/javascript" src="../../../ckeditor_basic.js"></script>
+	<script type="text/javascript" src="../test.js"></script>
+	<script type="text/javascript">
+	//<![CDATA[
+
+var before_loadFullCore = CKEDITOR.status;
+
+CKEDITOR.loadFullCore();
+
+	//]]>
+	</script>
+	<script type="text/javascript">
+	//<![CDATA[
+
+CKEDITOR.test.addTestCase( (function()
+{
+	// Local reference to the "assert" object.
+	var assert = CKEDITOR.test.assert;
+
+	return {
+		test_status1 : function()
+		{
+			assert.areSame( 'basic_loaded', before_loadFullCore );
+		},
+
+		test_status2 : function()
+		{
+			assert.areSame( 'loaded', CKEDITOR.status );
+		},
+
+		name : document.title
+	};
+})() );
+
+	//]]>
+	</script>
+</head>
+<body>
+</body>
+</html>
Index: /CKEditor/branches/prototype/_source/tests/core/env.html
===================================================================
--- /CKEditor/branches/prototype/_source/tests/core/env.html	(revision 2152)
+++ /CKEditor/branches/prototype/_source/tests/core/env.html	(revision 2153)
@@ -29,5 +29,5 @@
 				assert.isFalse( CKEDITOR.env.ie );
 		},
-		
+
 		test_isCompatible : function()
 		{
Index: /CKEditor/branches/prototype/_source/tests/core/tools.html
===================================================================
--- /CKEditor/branches/prototype/_source/tests/core/tools.html	(revision 2152)
+++ /CKEditor/branches/prototype/_source/tests/core/tools.html	(revision 2153)
@@ -62,5 +62,5 @@
 			assert.areSame( fakeArray	, target.prop7, 'prop7 doesn\'t match' );
 		},
-		
+
 		test_isArray1 : function()
 		{
Index: /CKEditor/branches/prototype/_source/tests/core/xml.html
===================================================================
--- /CKEditor/branches/prototype/_source/tests/core/xml.html	(revision 2152)
+++ /CKEditor/branches/prototype/_source/tests/core/xml.html	(revision 2153)
@@ -20,5 +20,5 @@
 			assert.isObject( xml.baseXml );
 		},
-		
+
 		test_selectSingleNode1a : function()
 		{
Index: /CKEditor/branches/prototype/_source/tests/test.js
===================================================================
--- /CKEditor/branches/prototype/_source/tests/test.js	(revision 2152)
+++ /CKEditor/branches/prototype/_source/tests/test.js	(revision 2153)
@@ -25,8 +25,8 @@
 // URLs copied from http://developer.yahoo.com/yui/yuitest/
 document.write(
-	'<script type="text/javascript" src="' + CKEDITOR.basePath + '_source/tests/yuitest.js"></script>' );
+	'<script type="text/javascript" src="' + CKEDITOR.scriptsPath + 'tests/yuitest.js"></script>' );
 
 document.write(
-	'<script type="text/javascript" src="' + CKEDITOR.basePath + '_source/core/test.js"></script>' );
+	'<script type="text/javascript" src="' + CKEDITOR.scriptsPath + 'core/test.js"></script>' );
 
 (function()
Index: /CKEditor/branches/prototype/_source/tests/testall.html
===================================================================
--- /CKEditor/branches/prototype/_source/tests/testall.html	(revision 2152)
+++ /CKEditor/branches/prototype/_source/tests/testall.html	(revision 2153)
@@ -11,4 +11,5 @@
 	'core/ajax',
 	'core/ckeditor',
+	'core/ckeditor2',
 	'core/editor',
 	'core/dom/element',
Index: /CKEditor/branches/prototype/ckeditor.js
===================================================================
--- /CKEditor/branches/prototype/ckeditor.js	(revision 2152)
+++ /CKEditor/branches/prototype/ckeditor.js	(revision 2153)
@@ -22,5 +22,5 @@
 // Compressed version of core/ckeditor_base.js. See original for instructions.
 /*jsl:ignore*/
-if (!window.CKEDITOR){window.CKEDITOR=(function(){return {_:{},status:'unloaded',basePath:(function(){var A='';var B=document.getElementsByTagName('script');for (var i=0;i<B.length;i++){var C=B[i].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?.js(?:\?.*)?$/i);if (C){A=C[1];break;}};if (A.indexOf('://')==-1){if (A.indexOf('/')==0) A=location.href.match(/^.*?:\/\/[^\/]*/)[0]+A;else A=location.href.match(/^[^\?]*\//)[0]+A;};return A;})()};})();};
+if (!window.CKEDITOR){window.CKEDITOR=(function(){var A={_:{},status:'unloaded',basePath:(function(){var B='';var C=document.getElementsByTagName('script');for (var i=0;i<C.length;i++){var D=C[i].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?.js(?:\?.*)?$/i);if (D){B=D[1];break;}};if (B.indexOf('://')==-1){if (B.indexOf('/')===0) B=location.href.match(/^.*?:\/\/[^\/]*/)[0]+B;else B=location.href.match(/^[^\?]*\//)[0]+B;};return B;})()};A.scriptsPath=A.basePath+'_source/';return A;})();};
 /*jsl:end*/
 
@@ -34,4 +34,4 @@
 	// Include the loader script.
 	document.write(
-		'<script type="text/javascript" src="' + CKEDITOR.basePath + '_source/core/loader.js"></script>' );
+		'<script type="text/javascript" src="' + CKEDITOR.scriptsPath + 'core/loader.js"></script>' );
 }
Index: /CKEditor/branches/prototype/ckeditor_basic.js
===================================================================
--- /CKEditor/branches/prototype/ckeditor_basic.js	(revision 2152)
+++ /CKEditor/branches/prototype/ckeditor_basic.js	(revision 2153)
@@ -22,5 +22,5 @@
 // Compressed version of core/ckeditor_base.js. See original for instructions.
 /*jsl:ignore*/
-if (!window.CKEDITOR){window.CKEDITOR=(function(){return {_:{},status:'unloaded',basePath:(function(){var A='';var B=document.getElementsByTagName('script');for (var i=0;i<B.length;i++){var C=B[i].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?.js(?:\?.*)?$/i);if (C){A=C[1];break;}};if (A.indexOf('://')==-1){if (A.indexOf('/')==0) A=location.href.match(/^.*?:\/\/[^\/]*/)[0]+A;else A=location.href.match(/^[^\?]*\//)[0]+A;};return A;})()};})();};
+if (!window.CKEDITOR){window.CKEDITOR=(function(){var A={_:{},status:'unloaded',basePath:(function(){var B='';var C=document.getElementsByTagName('script');for (var i=0;i<C.length;i++){var D=C[i].src.match(/(^|.*[\\\/])ckeditor(?:_basic)?.js(?:\?.*)?$/i);if (D){B=D[1];break;}};if (B.indexOf('://')==-1){if (B.indexOf('/')===0) B=location.href.match(/^.*?:\/\/[^\/]*/)[0]+B;else B=location.href.match(/^[^\?]*\//)[0]+B;};return B;})()};A.scriptsPath=A.basePath+'_source/';return A;})();};
 /*jsl:end*/
 
@@ -30,3 +30,3 @@
 // Include the loader script.
 document.write(
-	'<script type="text/javascript" src="' + CKEDITOR.basePath + '_source/core/loader.js"></script>' );
+	'<script type="text/javascript" src="' + CKEDITOR.scriptsPath + 'core/loader.js"></script>' );
