Index: /CKEditor/trunk/_source/plugins/scayt/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/scayt/plugin.js	(revision 5333)
+++ /CKEditor/trunk/_source/plugins/scayt/plugin.js	(revision 5334)
@@ -42,9 +42,9 @@
 			oParams.srcNodeRef = editor.document.getWindow().$.frameElement;
 			// syntax : AppName.AppVersion@AppRevision
-			oParams.assocApp  = "CKEDITOR." + CKEDITOR.version + "@" + CKEDITOR.revision;
-			oParams.customerid = editor.config.scayt_customerid  || "1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2";
+			oParams.assocApp  = 'CKEDITOR.' + CKEDITOR.version + '@' + CKEDITOR.revision;
+			oParams.customerid = editor.config.scayt_customerid  || '1:WvF0D4-UtPqN1-43nkD4-NKvUm2-daQqk3-LmNiI-z7Ysb4-mwry24-T8YrS3-Q2tpq2';
 			oParams.customDictionaryIds = editor.config.scayt_customDictionaryIds || '';
 			oParams.userDictionaryName = editor.config.scayt_userDictionaryName || '';
-			oParams.sLang = editor.config.scayt_sLang || "en_US";
+			oParams.sLang = editor.config.scayt_sLang || 'en_US';
 
 			oParams.onBeforeChange = function()
@@ -62,8 +62,8 @@
 				}
 			}
-			
+			// needs for restoring a specific scayt control settings
 			if ( scayt_control_id )
 				oParams.id = scayt_control_id;
-			
+
 			var scayt_control = new window.scayt( oParams );
 
@@ -118,10 +118,11 @@
 				if ( (ev.data.name == 'source' ||  ev.data.name == 'newpage') && editor.mode == 'wysiwyg' )
 				{
-					var scayt_instanse = plugin.getScayt( editor );
-					if ( scayt_instanse )
-					{
-						scayt_paused = scayt_instanse.paused = !scayt_instanse.disabled;
-						scayt_control_id = scayt_instanse.id;
-						scayt_instanse.destroy( true );
+					var scayt_instance = plugin.getScayt( editor );
+					if ( scayt_instance )
+					{
+						scayt_paused = scayt_instance.paused = !scayt_instance.disabled;
+						// store a control id for restore a specific scayt control settings
+						scayt_control_id = scayt_instance.id;
+						scayt_instance.destroy( true );
 						delete plugin.instances[ editor.name ];
 					}
@@ -129,15 +130,19 @@
 			});
 
-
-		editor.on( 'destroy', function()
-			{
-				scayt_control_id = scayt_instanse.id;
-				plugin.getScayt( editor ).destroy( true );
+		editor.on( 'destroy', function( ev )
+			{
+				var editor = ev.editor,
+					scayt_instance = plugin.getScayt( editor );
+				// store a control id for restore a specific scayt control settings
+				scayt_control_id = scayt_instance.id;
+				scayt_instance.destroy( true );
+				delete plugin.instances[ editor.name ];
 			});
+
 		// Listen to data manipulation to reflect scayt markup.
 		editor.on( 'afterSetData', function()
 			{
 				if ( plugin.isScaytEnabled( editor ) ) {
-					window.setTimeout( function(){ plugin.getScayt( editor ).refresh() }, 10 );
+					window.setTimeout( function(){ plugin.getScayt( editor ).refresh(); }, 10 );
 				}
 			});
@@ -155,5 +160,5 @@
 
 					// Swallow any SCAYT engine errors.
-					window.setTimeout( function(){ scayt_instance.refresh() }, 10 );
+					window.setTimeout( function(){ scayt_instance.refresh(); }, 10 );
 				}
 			}, this, null, 50 );
@@ -161,5 +166,4 @@
 		editor.on( 'insertHtml', function()
 			{
-
 				var scayt_instance = plugin.getScayt( editor );
 				if ( plugin.isScaytEnabled( editor ) )
@@ -171,7 +175,5 @@
 
 					// Swallow any SCAYT engine errors.
-					
-					window.setTimeout( function(){ scayt_instance.refresh() },10 );
-					
+					window.setTimeout( function(){ scayt_instance.refresh(); },10 );
 				}
 			}, this, null, 50 );
@@ -187,4 +189,5 @@
 		var dataProcessor = editor.dataProcessor,
 			htmlFilter = dataProcessor && dataProcessor.htmlFilter;
+
 		if ( htmlFilter )
 		{
@@ -225,6 +228,6 @@
 		isScaytEnabled : function( editor )
 		{
-			var scayt_instanse = this.getScayt( editor );
-			return ( scayt_instanse ) ? scayt_instanse.disabled === false : false;
+			var scayt_instance = this.getScayt( editor );
+			return ( scayt_instance ) ? scayt_instance.disabled === false : false;
 		},
 		loadEngine : function( editor )
@@ -245,5 +248,5 @@
 				this,
 				null,
-				0 
+				0
 			);	// First to run.
 
@@ -254,8 +257,8 @@
 			// Default to 'http' for unknown.
 			protocol = protocol.search( /https?:/) != -1? protocol : 'http:';
-			var baseUrl  = "svc.spellchecker.net/spellcheck31/lf/scayt/scayt22.js";
-
-			var scaytUrl  =  editor.config.scayt_srcUrl || ( protocol + "//" + baseUrl );
-			var scaytConfigBaseUrl =  plugin.parseUrl( scaytUrl ).path +  "/";
+			var baseUrl  = 'svc.spellchecker.net/spellcheck31/lf/scayt/scayt22.js';
+
+			var scaytUrl  =  editor.config.scayt_srcUrl || ( protocol + '//' + baseUrl );
+			var scaytConfigBaseUrl =  plugin.parseUrl( scaytUrl ).path +  '/';
 
 			CKEDITOR._djScaytConfig =
@@ -266,5 +269,5 @@
 					function()
 					{
-						CKEDITOR.fireOnce( "scaytReady" );
+						CKEDITOR.fireOnce( 'scaytReady' );
 					}
 				],
@@ -366,13 +369,13 @@
 			CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/options.js' ) );
 			// read ui tags
-			var confuiTabs = editor.config.scayt_uiTabs || "1,1,1";
+			var confuiTabs = editor.config.scayt_uiTabs || '1,1,1';
 			var uiTabs =[];
-			// string tp array convert
-			confuiTabs = confuiTabs.split(",");
-			// check array length ! allwaays must be 3 filled with 1 or 0
+			// string to array convert
+			confuiTabs = confuiTabs.split( ',' );
+			// check array length ! always must be 3 filled with 1 or 0
 			for (var i=0,l=3; i<l; i++)
 			{
-				var flag = parseInt(confuiTabs[i] || "1" ,10);
-				uiTabs.push(  flag  );
+				var flag = parseInt(confuiTabs[i] || '1' ,10);
+				uiTabs.push( flag );
 			}
 
@@ -382,5 +385,5 @@
 			var uiMuneItems = {};
 
-			// allways added
+			// always added
 			uiMuneItems.scaytToggle =
 				{
@@ -424,5 +427,5 @@
 					}
 				};
-			// allways added
+			// always added
 			uiMuneItems.scaytAbout =
 				{
@@ -437,5 +440,5 @@
 			;
 
-			uiTabs[3] = 1; // about us tab is allways on
+			uiTabs[3] = 1; // about us tab is always on
 			plugin.uiTabs = uiTabs;
 
@@ -481,5 +484,5 @@
 						var scayt_control = plugin.getScayt( editor ),
 							node = scayt_control.getScaytNode();
-						
+
 						if ( !node )
 							return null;
@@ -509,5 +512,5 @@
 						mainSuggestions = {};
 
-						var moreSuggestionsUnable = editor.config.scayt_moreSuggestions || "on";
+						var moreSuggestionsUnable = editor.config.scayt_moreSuggestions || 'on';
 						var moreSuggestionsUnableAdded = false;
 
@@ -516,6 +519,6 @@
 						!maxSuggestions && ( maxSuggestions = items_suggestion.length );
 
-						var contextCommands = editor.config.scayt_contextCommands || "all";
-						contextCommands = contextCommands.split("|");
+						var contextCommands = editor.config.scayt_contextCommands || 'all';
+						contextCommands = contextCommands.split( '|' );
 
 						for ( var i = 0, l = items_suggestion.length; i < l; i += 1 )
@@ -539,5 +542,5 @@
 								mainSuggestions[ commandName ] = CKEDITOR.TRISTATE_OFF;
 							}
-							else if ( moreSuggestionsUnable == "on" )
+							else if ( moreSuggestionsUnable == 'on' )
 							{
 								addButtonCommand( editor, 'button_' + commandName, items_suggestion[i],
@@ -548,6 +551,7 @@
 						}
 
-						if ( moreSuggestionsUnableAdded ){
-							// Rgister the More suggestions group;
+						if ( moreSuggestionsUnableAdded )
+						{
+							// Register the More suggestions group;
 							editor.addMenuItem( 'scayt_moresuggest',
 							{
@@ -561,8 +565,7 @@
 							});
 							mainSuggestions[ 'scayt_moresuggest' ] = CKEDITOR.TRISTATE_OFF;
-
-						}
-
-						if ( in_array( "all",contextCommands )  || in_array("ignore",contextCommands)  )
+						}
+
+						if ( in_array( 'all', contextCommands )  || in_array( 'ignore', contextCommands)  )
 						{
 							var ignore_command = {
@@ -571,9 +574,9 @@
 								}
 							};
-							addButtonCommand(editor, 'ignore', editor.lang.scayt.ignore, 'scayt_ignore', ignore_command, 'scayt_control', 1);
-							mainSuggestions['scayt_ignore'] = CKEDITOR.TRISTATE_OFF;
-						}
-
-						if ( in_array( "all",contextCommands )  || in_array("ignoreall",contextCommands)  )
+							addButtonCommand( editor, 'ignore', editor.lang.scayt.ignore, 'scayt_ignore', ignore_command, 'scayt_control', 1 );
+							mainSuggestions[ 'scayt_ignore' ] = CKEDITOR.TRISTATE_OFF;
+						}
+
+						if ( in_array( 'all', contextCommands )  || in_array( 'ignoreall', contextCommands ) )
 						{
 							var ignore_all_command = {
@@ -586,5 +589,5 @@
 						}
 
-						if ( in_array( "all",contextCommands )  || in_array("add",contextCommands)  )
+						if ( in_array( 'all', contextCommands )  || in_array( 'add', contextCommands ) )
 						{
 							var addword_command = {
@@ -665,5 +668,5 @@
 
 /**
- * Sets the customer ID for SCAYT. Required for migration from free version 
+ * Sets the customer ID for SCAYT. Required for migration from free version
  * with banner to paid version.
  * @name CKEDITOR.config.scayt_customerid
@@ -741,5 +744,5 @@
 /**
  * Links SCAYT to custom dictionaries. It's a string containing dictionary ids
- * separared by commas (","). Available only for licensed version. 
+ * separared by commas (","). Available only for licensed version.
  * Further details at http://wiki.spellchecker.net/doku.php?id=custom_dictionary_support .
  * @name CKEDITOR.config.scayt_customDictionaryIds
