Index: /CKEditor/trunk/CHANGES.html
===================================================================
--- /CKEditor/trunk/CHANGES.html	(revision 6517)
+++ /CKEditor/trunk/CHANGES.html	(revision 6518)
@@ -65,4 +65,5 @@
 		<li><a href="http://dev.ckeditor.com/ticket/6865">#6865</a> : BiDi mirroring doesn't work when a text direction change is done through dialog.</li>
 		<li><a href="http://dev.ckeditor.com/ticket/6966">#6966</a> : [IE] Unintended paragraph is created on empty document in enter mode BR and DIV.</li>
+		<li><a href="http://dev.ckeditor.com/ticket/7084">#7084</a> : SCAYT dialog window is now working properly with more than one editor instance in a page.</li>
 		<li>Updated the following language files:<ul>
 			<li><a href="http://dev.ckeditor.com/ticket/7124">#7124</a> : Czech;</li>
Index: /CKEditor/trunk/_source/plugins/scayt/dialogs/options.js
===================================================================
--- /CKEditor/trunk/_source/plugins/scayt/dialogs/options.js	(revision 6517)
+++ /CKEditor/trunk/_source/plugins/scayt/dialogs/options.js	(revision 6518)
@@ -9,5 +9,6 @@
 		captions,
 		doc = CKEDITOR.document,
-		tags = [],
+		editorName = editor.name,
+		tags = CKEDITOR.plugins.scayt.getUiTabs( editor ),
 		i,
 		contents = [],
@@ -15,7 +16,7 @@
 		dic_buttons = [
 			// [0] contains buttons for creating
-			"dic_create,dic_restore",
+			"dic_create_" + editorName + ",dic_restore_" + editorName,
 			// [1] contains buton for manipulation
-			"dic_rename,dic_delete"
+			"dic_rename_" + editorName + ",dic_delete_" + editorName
 		],
 		optionsIds = [ 'mixedCase', 'mixedWithDigits', 'allCaps', 'ignoreDomainNames' ];
@@ -25,9 +26,13 @@
 	function getBOMAllOptions()
 	{
-		 return document.forms.optionsbar["options"];
+		if (typeof document.forms["optionsbar_" + editorName] != "undefined")
+			return document.forms["optionsbar_" + editorName]["options"];
+		return [];
 	}
 	function getBOMAllLangs()
 	{
-		 return document.forms.languagesbar["scayt_lang"];
+		if (typeof document.forms["languagesbar_" + editorName] != "undefined")
+			return document.forms["languagesbar_" + editorName]["scayt_lang"];
+		return [];
 	}
 
@@ -59,21 +64,21 @@
 							type : 'html',
 							id : 'options',
-							html : 	'<form name="optionsbar"><div class="inner_options">' +
+							html : 	'<form name="optionsbar_' + editorName + '"><div class="inner_options">' +
 									'	<div class="messagebox"></div>' +
 									'	<div style="display:none;">' +
-									'		<input type="checkbox" name="options"  id="allCaps" />' +
-									'		<label for="allCaps" id="label_allCaps"></label>' +
+									'		<input type="checkbox" name="options"  id="allCaps_' + editorName + '" />' +
+									'		<label for="allCaps" id="label_allCaps_' + editorName + '"></label>' +
 									'	</div>' +
 									'	<div style="display:none;">' +
-									'		<input name="options" type="checkbox"  id="ignoreDomainNames" />' +
-									'		<label for="ignoreDomainNames" id="label_ignoreDomainNames"></label>' +
+									'		<input name="options" type="checkbox"  id="ignoreDomainNames_' + editorName + '" />' +
+									'		<label for="ignoreDomainNames" id="label_ignoreDomainNames_' + editorName + '"></label>' +
 									'	</div>' +
 									'	<div style="display:none;">' +
-									'	<input name="options" type="checkbox"  id="mixedCase" />' +
-									'		<label for="mixedCase" id="label_mixedCase"></label>' +
+									'	<input name="options" type="checkbox"  id="mixedCase_' + editorName + '" />' +
+									'		<label for="mixedCase" id="label_mixedCase_' + editorName + '"></label>' +
 									'	</div>' +
 									'	<div style="display:none;">' +
-									'		<input name="options" type="checkbox"  id="mixedWithDigits" />' +
-									'		<label for="mixedWithDigits" id="label_mixedWithDigits"></label>' +
+									'		<input name="options" type="checkbox"  id="mixedWithDigits_' + editorName + '" />' +
+									'		<label for="mixedWithDigits" id="label_mixedWithDigits_' + editorName + '"></label>' +
 									'	</div>' +
 									'</div></form>'
@@ -88,8 +93,8 @@
 							type : 'html',
 							id : 'langs',
-							html : 	'<form name="languagesbar"><div class="inner_langs">' +
+							html : 	'<form name="languagesbar_' + editorName + '"><div class="inner_langs">' +
 									'	<div class="messagebox"></div>	' +
-									'   <div style="float:left;width:45%;margin-left:5px;" id="scayt_lcol" ></div>' +
-									'   <div style="float:left;width:45%;margin-left:15px;" id="scayt_rcol"></div>' +
+									'   <div style="float:left;width:45%;margin-left:5px;" id="scayt_lcol_' + editorName + '" ></div>' +
+									'   <div style="float:left;width:45%;margin-left:15px;" id="scayt_rcol_' + editorName + '"></div>' +
 									'</div></form>'
 						}
@@ -104,23 +109,23 @@
 							style: '',
 							id : 'dictionaries',
-							html : 	'<form name="dictionarybar"><div class="inner_dictionary" style="text-align:left; white-space:normal; width:320px; overflow: hidden;">' +
-									'	<div style="margin:5px auto; width:80%;white-space:normal; overflow:hidden;" id="dic_message"> </div>' +
+							html : 	'<form name="dictionarybar_' + editorName + '"><div class="inner_dictionary" style="text-align:left; white-space:normal; width:320px; overflow: hidden;">' +
+									'	<div style="margin:5px auto; width:80%;white-space:normal; overflow:hidden;" id="dic_message_' + editorName + '"> </div>' +
 									'	<div style="margin:5px auto; width:80%;white-space:normal;"> ' +
 									'       <span class="cke_dialog_ui_labeled_label" >Dictionary name</span><br>'+
 									'		<span class="cke_dialog_ui_labeled_content" >'+
 									'			<div class="cke_dialog_ui_input_text">'+
-									'				<input id="dic_name" type="text" class="cke_dialog_ui_input_text"/>'+
+									'				<input id="dic_name_' + editorName + '" type="text" class="cke_dialog_ui_input_text"/>'+
 									'		</div></span></div>'+
 									'		<div style="margin:5px auto; width:80%;white-space:normal;">'+
-									'			<a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_create">'+
+									'			<a style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_create_' + editorName + '">'+
 									'				</a>' +
-									'			<a  style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_delete">'+
+									'			<a  style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_delete_' + editorName + '">'+
 									'				</a>' +
-									'			<a  style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_rename">'+
+									'			<a  style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_rename_' + editorName + '">'+
 									'				</a>' +
-									'			<a  style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_restore">'+
+									'			<a  style="display:none;" class="cke_dialog_ui_button" href="javascript:void(0)" id="dic_restore_' + editorName + '">'+
 									'				</a>' +
 									'		</div>' +
-									'	<div style="margin:5px auto; width:95%;white-space:normal;" id="dic_info"></div>' +
+									'	<div style="margin:5px auto; width:95%;white-space:normal;" id="dic_info_' + editorName + '"></div>' +
 									'</div></form>'
 						}
@@ -135,5 +140,5 @@
 							id : 'about',
 							style : 'margin: 5px 5px;',
-							html : '<div id="scayt_about"></div>'
+							html : '<div id="scayt_about_' + editorName + '"></div>'
 						}
 					]
@@ -150,6 +155,6 @@
 			dialog.data = editor.fire( 'scaytDialog', {} );
 			dialog.options = dialog.data.scayt_control.option();
-			dialog.sLang = dialog.data.scayt_control.sLang;
-
+			dialog.chosed_lang = dialog.sLang = dialog.data.scayt_control.sLang;
+			
 			if ( !dialog.data || !dialog.data.scayt || !dialog.data.scayt_control )
 			{
@@ -181,5 +186,5 @@
 			var scayt_control =  this.data.scayt_control;
 			scayt_control.option( this.options );
-			// Setup languge if it was changed.
+			// Setup language if it was changed.
 			var csLang = this.chosed_lang;
 			scayt_control.setLang( csLang );
@@ -199,7 +204,5 @@
 	var scayt_control = CKEDITOR.plugins.scayt.getScayt( editor );
 
-	tags = CKEDITOR.plugins.scayt.uiTabs;
-
-	for ( i in tags )
+	for ( var i = 0; i < tags.length; i++ )
 	{
 		if ( tags[ i ] == 1 )
@@ -209,10 +212,11 @@
 		userDicActive = 1;
 
-
 	var init_with_captions = function()
 	{
 		var dialog = this,
 			lang_list = dialog.data.scayt.getLangList(),
-			buttons = [ 'dic_create', 'dic_delete', 'dic_rename', 'dic_restore' ],
+			buttonCaptions = [ 'dic_create', 'dic_delete', 'dic_rename', 'dic_restore' ],
+			buttonIds = [],
+			langList = [],
 			labels = optionsIds,
 			i;
@@ -221,12 +225,11 @@
 		if ( userDicActive )
 		{
-			for ( i = 0; i < buttons.length; i++ )
-			{
-				var button = buttons[ i ];
-				doc.getById( button ).setHtml( '<span class="cke_dialog_ui_button">' + captions[ 'button_' + button]  +'</span>' );
-			}
-			doc.getById( 'dic_info' ).setHtml( captions[ 'dic_info' ] );
-		}
-
+			for ( i = 0; i < buttonCaptions.length; i++ )
+			{
+				buttonIds[ i ] = buttonCaptions[ i ] + "_" + editorName;
+				doc.getById( buttonIds[ i ] ).setHtml( '<span class="cke_dialog_ui_button">' + captions[ 'button_' + buttonCaptions[ i ]]  +'</span>' );
+			}
+			doc.getById( 'dic_info_' + editorName ).setHtml( captions[ 'dic_info' ] );
+		}
 
 		// Fill options and dictionary labels.
@@ -235,12 +238,13 @@
 			for ( i in labels )
 			{
-				var label = 'label_' + labels[ i ],
-					labelElement = doc.getById( label );
-
+				var labelCaption = 'label_' + labels[ i ],
+					labelId = labelCaption + '_' + editorName,
+					labelElement = doc.getById( labelId );
+				
 				if (  'undefined' != typeof labelElement
-				   && 'undefined' != typeof captions[ label ]
+				   && 'undefined' != typeof captions[ labelCaption ]
 				   && 'undefined' != typeof dialog.options[labels[ i ]] )
 				{
-					labelElement.setHtml( captions[ label ] );
+					labelElement.setHtml( captions[ labelCaption ] );
 					var labelParent = labelElement.getParent();
 					labelParent.$.style.display = "block";
@@ -253,5 +257,5 @@
 				'<p>' + captions[ 'about_throwt_copy' ] + '</p>';
 
-		doc.getById( 'scayt_about' ).setHtml( about );
+		doc.getById( 'scayt_about_' + editorName ).setHtml( about );
 
 		// Create languages tab.
@@ -287,5 +291,4 @@
 		};
 
-		var langList = [];
 		if ( tags[1] ==1 )
 		{
@@ -301,6 +304,6 @@
 				});
 
-			var fieldL = doc.getById( 'scayt_lcol' ),
-				fieldR = doc.getById( 'scayt_rcol' );
+			var fieldL = doc.getById( 'scayt_lcol_' + editorName ),
+				fieldR = doc.getById( 'scayt_rcol_' + editorName );
 			for ( i=0; i < langList.length; i++ )
 			{
@@ -404,5 +407,5 @@
 		function onDicButtonClick( ev )
 		{
-			var dic_name = doc.getById('dic_name').getValue();
+			var dic_name = doc.getById('dic_name_' + editorName).getValue();
 			if ( !dic_name )
 			{
@@ -411,6 +414,6 @@
 			}
 			try{
-				var el = id = ev.data.getTarget().getParent();
-				var id = el.getId();
+				var el = ev.data.getTarget().getParent();
+				var id = /(dic_\w+)_[\w\d]+/.exec(el.getId())[1];
 				dic[ id ].apply( null, [ el, dic_name, dic_buttons ] );
 			}
@@ -453,5 +456,5 @@
 					opto[k].checked = false;
 					//alert (opto[k].removeAttribute)
-					if ( dialog.options[ i ] == 1 )
+					if ( dialog.options[ i.split("_")[0] ] == 1 )
 					{
 						opto[k].checked = true;
@@ -464,5 +467,5 @@
 						checkbox.on( 'click', function()
 						{
-							dialog.options[ this.getId() ] = this.$.checked ? 1 : 0 ;
+							dialog.options[ this.getId().split("_")[0] ] = this.$.checked ? 1 : 0 ;
 						});
 					}
@@ -488,5 +491,5 @@
 					if ( dic_name )
 					{
-						doc.getById( 'dic_name' ).setValue(dic_name);
+						doc.getById( 'dic_name_' + editorName ).setValue(dic_name);
 						display_dic_buttons( dic_buttons[1] );
 					}
@@ -497,5 +500,5 @@
 				function()
 				{
-					doc.getById( 'dic_name' ).setValue("");
+					doc.getById( 'dic_name_' + editorName ).setValue("");
 				});
 			dic_success_message("");
@@ -506,9 +509,9 @@
 	function dic_error_message( m )
 	{
-		doc.getById('dic_message').setHtml('<span style="color:red;">' + m + '</span>' );
+		doc.getById('dic_message_' + editorName).setHtml('<span style="color:red;">' + m + '</span>' );
 	}
 	function dic_success_message( m )
 	{
-		doc.getById('dic_message').setHtml('<span style="color:blue;">' + m + '</span>') ;
+		doc.getById('dic_message_' + editorName).setHtml('<span style="color:blue;">' + m + '</span>') ;
 	}
 	function display_dic_buttons( sIds )
@@ -528,5 +531,5 @@
 	function set_dic_name( dic_name )
 	{
-		doc.getById('dic_name').$.value= dic_name;
+		doc.getById('dic_name_' + editorName).$.value= dic_name;
 	}
 
Index: /CKEditor/trunk/_source/plugins/scayt/plugin.js
===================================================================
--- /CKEditor/trunk/_source/plugins/scayt/plugin.js	(revision 6517)
+++ /CKEditor/trunk/_source/plugins/scayt/plugin.js	(revision 6518)
@@ -96,13 +96,4 @@
 			plugin.instances[ editor.name ] = scayt_control;
 
-			//window.scayt.uiTags
-			var menuGroup = 'scaytButton';
-			var uiTabs = window.scayt.uiTags;
-			var fTabs  = [];
-
-			for ( var i = 0, l=4; i < l; i++ )
-			    fTabs.push( uiTabs[i] && plugin.uiTabs[i] );
-
-			plugin.uiTabs = fTabs;
 			try {
 				scayt_control.setDisabled( plugin.isPaused( editor ) === false );
@@ -356,4 +347,24 @@
 			var scayt_instance = this.getScayt( editor );
 			return ( scayt_instance ) ? scayt_instance.disabled === false : false;
+		},
+		getUiTabs : function( editor )
+		{
+			var uiTabs = [];
+			
+			// read UI tabs value from config
+			var configUiTabs = editor.config.scayt_uiTabs || "1,1,1";
+			
+			// convert string to array
+			configUiTabs = configUiTabs.split( ',' );
+			
+			// "About us" should be always shown for standard config
+			configUiTabs[3] = "1";
+			
+			for ( var i = 0; i < 4; i++ ) {
+				uiTabs[i] = (typeof window.scayt != "undefined" && typeof window.scayt.uiTags != "undefined")
+								? (parseInt(configUiTabs[i],10) && window.scayt.uiTags[i]) 
+								: parseInt(configUiTabs[i],10);
+			}
+			return uiTabs;
 		},
 		loadEngine : function( editor )
@@ -529,25 +540,16 @@
 			// Add Options dialog.
 			CKEDITOR.dialog.add( commandName, CKEDITOR.getUrl( this.path + 'dialogs/options.js' ) );
-			// read ui tags
-			var confuiTabs = editor.config.scayt_uiTabs || '1,1,1';
-			var uiTabs =[];
-			// 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 uiTabs = plugin.getUiTabs( editor );
+			
 			var menuGroup = 'scaytButton';
 			editor.addMenuGroup( menuGroup );
 			// combine menu items to render
-			var uiMuneItems = {};
+			var uiMenuItems = {};
 
 			var lang = editor.lang.scayt;
 
 			// always added
-			uiMuneItems.scaytToggle =
+			uiMenuItems.scaytToggle =
 				{
 					label : lang.enable,
@@ -557,5 +559,5 @@
 
 			if ( uiTabs[0] == 1 )
-				uiMuneItems.scaytOptions =
+				uiMenuItems.scaytOptions =
 				{
 					label : lang.options,
@@ -569,5 +571,5 @@
 
 			if ( uiTabs[1] == 1 )
-				uiMuneItems.scaytLangs =
+				uiMenuItems.scaytLangs =
 				{
 					label : lang.langs,
@@ -580,5 +582,5 @@
 				};
 			if ( uiTabs[2] == 1 )
-				uiMuneItems.scaytDict =
+				uiMenuItems.scaytDict =
 				{
 					label : lang.dictionariesTab,
@@ -591,5 +593,5 @@
 				};
 			// always added
-			uiMuneItems.scaytAbout =
+			uiMenuItems.scaytAbout =
 				{
 					label : editor.lang.scayt.about,
@@ -601,9 +603,6 @@
 					}
 				};
-
-			uiTabs[3] = 1; // about us tab is always on
-			plugin.uiTabs = uiTabs;
-
-			editor.addMenuItems( uiMuneItems );
+		
+			editor.addMenuItems( uiMenuItems );
 
 				editor.ui.add( 'Scayt', CKEDITOR.UI_MENUBUTTON,
@@ -626,11 +625,13 @@
 
 							editor.getMenuItem( 'scaytToggle' ).label = lang[ isEnabled ? 'disable' : 'enable' ];
-
+							
+							var uiTabs = plugin.getUiTabs( editor );
+							
 							return {
 								scaytToggle  : CKEDITOR.TRISTATE_OFF,
-								scaytOptions : isEnabled && plugin.uiTabs[0] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
-								scaytLangs   : isEnabled && plugin.uiTabs[1] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
-								scaytDict    : isEnabled && plugin.uiTabs[2] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
-								scaytAbout   : isEnabled && plugin.uiTabs[3] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED
+								scaytOptions : isEnabled && uiTabs[0] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
+								scaytLangs   : isEnabled && uiTabs[1] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
+								scaytDict    : isEnabled && uiTabs[2] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED,
+								scaytAbout   : isEnabled && uiTabs[3] ? CKEDITOR.TRISTATE_OFF : CKEDITOR.TRISTATE_DISABLED
 							};
 						}
