Index: /CKEditor/branches/prototype/_source/core/config.js
===================================================================
--- /CKEditor/branches/prototype/_source/core/config.js	(revision 2901)
+++ /CKEditor/branches/prototype/_source/core/config.js	(revision 2902)
@@ -336,4 +336,5 @@
 		smiley :
 		{
+			// TODO: update descriptions, fix coding style.
 			/**
 			 * List of smiley images displayed in the Smiley dialog.
@@ -360,10 +361,51 @@
 		flash :
 		{
+			uploadTab : true,
+			uploadAction : 'nowhere.php',
+			browseServer : true,
+			showAdvancedTab : true,
+			showPropertiesTab : true,
+
+			/**
+			 * Save as EMBED tag only. This tag is unrecommended.
+			 * @type Boolean
+			 * @default false
+			 */
+			embedTagOnly : false,
+
+			/**
+			 * Add EMBED tag as alternative: &lt;object&gt&lt;embed&gt&lt;/embed&gt&lt;/object&gt
+			 * @type Boolean
+			 * @default false
+			 */
+			addEmbedTag : true,
+
+			/**
+			 * Use embedTagOnly and addEmbedTag values on edit.
+			 * @type Boolean
+			 * @default false
+			 */
+			convertOnEdit : false,
+
 			defaultValues :
 			{
-				uploadTab : true,
-				uploadAction : 'nowhere.php',
-				browseServer : true,
-				showAdvancedTab : true
+				access :	'',
+				width :		'',
+				height :	'',
+				hSpace :	'',
+				vSpace :	'',
+				cssClass :	'',
+				cssStyle :	'',
+				bgcolor :	'',
+				title :		'',
+				loop :		'true',
+				play :		'true',
+				menu :		'true',
+				align :		'',
+				quality :	'high',
+				scale :		'',
+				flashvars :	'',
+				allowfullscreen:'',
+				windowMode :	''
 			}
 		},
@@ -372,15 +414,15 @@
 			defaultValues :
 			{
-				rows : '3',
-				columns : '',
-				border : '1',
-				align : '',
-				width : '200',
-				widthType : 'pixels',
-				height : '',
-				cellspacing : '',
-				cellpadding : '',
-				caption : '',
-				summary : ''			
+				rows :		'3',
+				columns :	'2',
+				border :	'1',
+				align :		'',
+				width :		'200',
+				widthType :	'pixels',
+				height :	'',
+				caption :	'',
+				summary :	'',
+				cellspacing :	'1',
+				cellpadding :	'1'
 			}
 		},
Index: /CKEditor/branches/prototype/_source/lang/en.js
===================================================================
--- /CKEditor/branches/prototype/_source/lang/en.js	(revision 2901)
+++ /CKEditor/branches/prototype/_source/lang/en.js	(revision 2902)
@@ -340,15 +340,36 @@
 	{
 		properties		: 'Flash Properties',
+		propertiesTab	: 'Properties',
 		title		: 'Flash Properties',
-		infoTab		: 'Flash Info',
 		chkPlay		: 'Auto Play',
 		chkLoop		: 'Loop',
 		chkMenu		: 'Enable Flash Menu',
-		scale		: 'Scale',
+		chkFull		: 'Allow Fullscreen',
+ 		scale		: 'Scale',
 		scaleAll		: 'Show all',
 		scaleNoBorder	: 'No Border',
 		scaleFit		: 'Exact Fit',
-		width		: 'Width',
-		height		: 'Height'
+		access			: 'Script Access',
+		accessAlways	: 'Always',
+		accessSameDomain	: 'Same domain',
+		accessNever	: 'Never',
+		align		: 'Align',
+		alignLeft	: 'Left',
+		alignAbsBottom: 'Abs Bottom',
+		alignAbsMiddle: 'Abs Middle',
+		alignBaseline	: 'Baseline',
+		alignBottom	: 'Bottom',
+		alignMiddle	: 'Middle',
+		alignRight	: 'Right',
+		alignTextTop	: 'Text Top',
+		alignTop	: 'Top',
+		quality		: 'Quality',
+		windowMode	: 'Window mode',
+		flashvars	: 'Variables for Flash',
+		bgcolor	: 'Background color',
+		width	: 'Width',
+		height	: 'Height',
+		hSpace	: 'HSpace',
+		vSpace	: 'VSpace'
 	},
 	
Index: /CKEditor/branches/prototype/_source/plugins/flash/dialogs/flash.js
===================================================================
--- /CKEditor/branches/prototype/_source/plugins/flash/dialogs/flash.js	(revision 2901)
+++ /CKEditor/branches/prototype/_source/plugins/flash/dialogs/flash.js	(revision 2902)
@@ -20,5 +20,4 @@
  */
  
-
 CKEDITOR.dialog.add( 'flash', function( editor ){
 {
@@ -35,5 +34,5 @@
 		'<span id="previewContainer"></span>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Maecenas feugiat consequat diam. Maecenas metus. Vivamus diam purus, cursus a, commodo non, facilisis vitae, nulla. Aenean dictum lacinia tortor. Nunc iaculis, nibh non iaculis aliquam, orci felis euismod neque, sed ornare massa mauris sed velit. Nulla pretium mi et risus. Fusce mi pede, tempor id, cursus ac, ullamcorper nec, enim. Sed tortor. Curabitur molestie. Duis velit augue, condimentum at, ultrices a, luctus ut, orci. Donec pellentesque egestas eros. Integer cursus, augue in cursus faucibus, eros pede bibendum sem, in tempus tellus justo quis ligula. Etiam eget tortor. Vestibulum rutrum, est ut placerat elementum, lectus nisl aliquam velit, tempor aliquam eros nunc nonummy metus. In eros metus, gravida a, gravida sed, lobortis id, turpis. </div></div>';
 
-	var addChange = function( name, input, type ){
+	var addChange = function( name, input, tag ){
 		var dialog = input.getDialog();
 		var result = false;
@@ -43,5 +42,5 @@
 			return 0;
 
-		if ( type & PARAM )
+		if ( tag & PARAM )
 			if ( input.getValue() != '' || input.isChanged() )
 			{
@@ -49,5 +48,5 @@
 				result = true;
 			}
-		if ( type & OBJECT )
+		if ( tag & OBJECT )
 			if ( input.getValue() != '' || input.isChanged() )
 			{
@@ -55,5 +54,5 @@
 				result = true;
 			}
-		if ( type & EMBED )
+		if ( tag & EMBED )
 			if ( input.getValue() != '' || input.isChanged() )
 			{
@@ -106,5 +105,5 @@
 	}
 
-	var readSize = function( dialog )
+	var readSize = function( dialog, mainObject )
 	{
 		var heightText = '';
@@ -112,7 +111,7 @@
 
 		// Read height.
-		if ( dialog.editObj[ 'flash' ].getAttribute( 'height' ) )
-		{
-			var aMatchH  =  dialog.editObj[ 'flash' ].getAttribute( 'height' ).match( regexSize );
+		if ( mainObject.getAttribute( 'height' ) )
+		{
+			var aMatchH  =  mainObject.getAttribute( 'height' ).match( regexSize );
 			if ( aMatchH )
 			{
@@ -125,7 +124,7 @@
 
 		// Read width.
-		if ( dialog.editObj[ 'flash' ].getAttribute( 'width' ) )
-		{
-			var aMatchW  =  dialog.editObj[ 'flash' ].getAttribute( 'width' ).match( regexSize );
+		if ( mainObject.getAttribute( 'width' ) )
+		{
+			var aMatchW  =  mainObject.getAttribute( 'width' ).match( regexSize );
 			if ( aMatchW )
 			{
@@ -138,5 +137,5 @@
 
 		// Read styles.
-		var aMatchW  =  dialog.editObj[ 'flash' ].$.style.width.match( regexSize );
+		var aMatchW  =  mainObject.$.style.width.match( regexSize );
 		if ( aMatchW )
 		{
@@ -149,5 +148,5 @@
 			dialog.dimensionsInStyle[ 'width' ] = true;
 		}
-		var aMatchH  =  dialog.editObj[ 'flash' ].$.style.height.match( regexSize );
+		var aMatchH  =  mainObject.$.style.height.match( regexSize );
 		if ( aMatchH )
 		{
@@ -168,28 +167,110 @@
 	}
 
+	var addParam = function( object, name, value )
+	{
+		var param = editor.document.createElement( 'param' );
+		param.setAttribute( 'value' , value );
+		param.setAttribute( 'name' , name );
+		object.append( param );
+		return param;
+	}
+
 	// Function called in onShow to load selected element.
-	var loadElements = function( editor, selection, ranges, element )
+	var loadElements = function( editor, selection, ranges, fakeElement, realElement )
 	{
+		selection.selectElement( fakeElement );
 		this.saveSelection();
-		this.editObj[ 'flash' ] = CKEDITOR.plugins.fakeobjects.restoreElement( element );
-
-		// Fill out all fields.
-		if ( !readAttribute.apply( this, [ 'info', '_cke_saved_url', 'txtUrl', imgObject ] ) )
-			readAttribute.apply( this, [ 'info', 'src', 'txtUrl', imgObject ] )
-
-		readAttribute.apply( this, [ 'advanced', 'id', 'cmbScale', imgObject ] );
-		readAttribute.apply( this, [ 'advanced', 'play', 'txtChkPlay', imgObject ] );
-		readAttribute.apply( this, [ 'advanced', 'loop', 'txtChkLoop', imgObject ] );
-		readAttribute.apply( this, [ 'advanced', 'menu', 'txtChkMenu', imgObject ] );
-		readAttribute.apply( this, [ 'advanced', 'id', 'txtGenId', imgObject ] );
-		readAttribute.apply( this, [ 'advanced', 'class', 'txtGenClass', imgObject ] );	
-		readAttribute.apply( this, [ 'advanced', 'style', 'txtGenStyle', imgObject ] );
-		readAttribute.apply( this, [ 'advanced', 'title', 'txtGenTitle', imgObject ] );
-
-		readSize( this );
+		this.editMode[ 'fakeobject' ] = realElement.getName();
+		this.editObj[ 'fakeobject' ] = fakeElement;
+
+		// Object element is selected
+		if ( this.editMode[ 'fakeobject' ] == 'object' ){
+			this.editObj[ 'embed' ] = false;
+			this.editObj[ 'object' ] = realElement;
+			var childCount = realElement.getChildCount();
+			var childObj;
+
+			// Search for Embed element.
+			for ( var i = 0; i < childCount; i++ )
+			{
+				childObj = realElement.getChild( i )
+				if ( childObj && childObj.getName() == 'embed' )
+				{
+					this.editObj[ 'embed' ] = childObj;
+					break;
+				}
+			}
+		}
+		else		// EMBED element is selected. RealTagName = embed.
+		{
+			this.editObj[ 'object' ] = false;
+			this.editObj[ 'embed' ] = realElement;
+		}
+
+		// 1. step - read EMBED element.
+		if ( this.editObj[ 'embed' ] ){
+			// Fill out all fields.
+			var embedElement = this.editObj[ 'embed' ];
+			/*
+			readAttribute.apply( this, [ 'advanced', 'id', 'cmbScale', embedElement ] );
+			readAttribute.apply( this, [ 'advanced', 'play', 'txtChkPlay', embedElement ] );
+			readAttribute.apply( this, [ 'advanced', 'loop', 'txtChkLoop', embedElement ] );
+			readAttribute.apply( this, [ 'advanced', 'menu', 'txtChkMenu', embedElement ] );
+			readAttribute.apply( this, [ 'advanced', 'id', 'txtGenId', embedElement ] );
+			readAttribute.apply( this, [ 'advanced', 'class', 'txtGenClass', embedElement ] );	
+			readAttribute.apply( this, [ 'advanced', 'style', 'txtGenStyle', embedElement ] );
+			readAttribute.apply( this, [ 'advanced', 'title', 'txtGenTitle', embedElement ] );
+			*/
+		}
+
+		// 2. step - read OBJECT element
+		if ( this.editObj[ 'object' ] ){
+			var objectElement = this.editObj[ 'object' ];
+			/*
+			readAttribute.apply( this, [ 'advanced', 'id', 'cmbScale', objectElement ] );
+			readAttribute.apply( this, [ 'advanced', 'play', 'txtChkPlay', objectElement ] );
+			readAttribute.apply( this, [ 'advanced', 'loop', 'txtChkLoop', objectElement ] );
+			readAttribute.apply( this, [ 'advanced', 'menu', 'txtChkMenu', objectElement ] );
+			readAttribute.apply( this, [ 'advanced', 'id', 'txtGenId', objectElement ] );
+			readAttribute.apply( this, [ 'advanced', 'class', 'txtGenClass', objectElement ] );	
+			readAttribute.apply( this, [ 'advanced', 'style', 'txtGenStyle', objectElement ] );
+			readAttribute.apply( this, [ 'advanced', 'title', 'txtGenTitle', objectElement ] );
+			*/
+			// 3. step - read OBJECT params (the most important)
+			var params = readParams( objectElement );
+			//TODO: read params.
+		}
+		if ( this.editObj[ 'object' ] )
+			readSize( this, this.editObj[ 'object' ] );
+		else
+			readSize( this, this.editObj[ 'embed' ] );
+
 		updatePreview( this );
 
 		return false;
 	};
+	
+	var readParams = function( object )
+	{
+		var params = new Array(),
+			name,
+			value,
+			i,
+			childCount = object.getChildCount();
+
+		// Search for PARAM elements.
+		for ( i = 0; i < childCount; i++ )
+		{
+			childObj = object.getChild( i )
+			if ( childObj && childObj.getName() == 'param' )
+			{
+				name = childObj.getAttribute( 'name' );
+				value = childObj.getAttribute( 'value' );
+				if ( name && value )
+					params[ name ] = value;
+			}
+		}
+		return params;
+	}
 	
 	var readAttribute = function( page, attribute, input, object )
@@ -221,4 +302,7 @@
 			if ( editor.config.pluginConfig.flash.browseServer == false )
 				this.getContentElement( 'info', 'browse' ).getElement().hide();
+	
+			if ( editor.config.pluginConfig.flash.embedTagOnly )
+				editor.config.pluginConfig.flash.addEmbedTag = true;
 		},	
 		onHide : function()
@@ -243,5 +327,6 @@
 			this.editObj[ 'fakeobject' ] = false;
 			this.editObj[ 'preview' ] = false;
-			this.editObj[ 'flash' ] = false;
+			this.editObj[ 'object' ] = false;
+			this.editObj[ 'embed' ] = false;
 			
 			// Default: create a new element.
@@ -270,12 +355,19 @@
 				rangeRoot = ranges[0].getCommonAncestor( true );
 				var element = rangeRoot.getAscendant( 'img', true );
-				if ( element && element.getAttribute( '_cke_real_element_type' ) && element.getAttribute( '_cke_real_element_type' ) == 'flash' )
+				if ( element && element.getAttribute( '_cke_real_element_type' ) )
 				{
-					this.editMode[ 'fakeobject' ] = true;
-					this.editObj[ 'fakeobject' ] = element;
-					element = CKEDITOR.plugins.fakeobjects.restoreElement( this.editObj[ 'fakeobject' ] );
-					loadElements.apply( this, [ editor, selection, ranges, element ] );
-					selection.selectElement( this.editObj[ 'fakeobject' ] );
-					this.saveSelection();
+					// Restore real element.
+					var tempObj = CKEDITOR.plugins.fakeobjects.restoreElement( element );
+					// Flash (EMBED tag)
+					if ( element.getAttribute( '_cke_real_element_type' ) == 'flash' )
+					{
+						loadElements.apply( this, [ editor, selection, ranges, element, tempObj ] );
+					}
+					else if ( element.getAttribute( '_cke_real_element_type' ) == 'object' )
+						// Flash (OBJECT tag)
+						if ( tempObj.getAttribute( 'type' ) == 'application/x-shockwave-flash' )
+						{
+							loadElements.apply( this, [ editor, selection, ranges, element, tempObj ] );
+						}
 				}
 			}
@@ -290,32 +382,40 @@
 			this.allowOnChange = true;
 
-			// Create a new fakeobject.
+			// Create a new flash.
 			if ( !this.editMode[ 'fakeobject' ] )
 			{
-				this.editObj[ 'object' ] = editor.document.createElement( 'object' );
-				this.editObj[ 'embed' ] = editor.document.createElement( 'embed' );
-			}
-			
-			// Create a new flash object.
-			if ( !this.editMode[ 'fakeobject' ] )
-			{
-				this.editObj[ 'flash' ] = editor.document.createElement( 'embed' );
-				
-				// TODO: this.editObj[ 'fakeobject' ].setRealemenet( this.editObj[ 'flash' ] );
-			}
+				if ( editor.config.pluginConfig.flash.embedTagOnly != true  )
+					this.editObj[ 'object' ] = editor.document.createElement( 'object' );
+				if ( editor.config.pluginConfig.flash.addEmbedTag == true )
+					this.editObj[ 'embed' ] = editor.document.createElement( 'embed' );
+			}
+
+			this.changedAttibutes[ 'EMBED' ][ 'type' ] = "application/x-shockwave-flash";
+			this.changedAttibutes[ 'OBJECT' ][ 'type' ] = "application/x-shockwave-flash";
 
 			// Set flash attributes.
-		//	this.editObj[ 'flash' ].setAttributes( this.changedAttibutes);
+			this.editObj[ 'object' ].setAttributes( this.changedAttibutes[ 'OBJECT' ] );
+			this.editObj[ 'embed' ].setAttributes( this.changedAttibutes[ 'EMBED' ] );
+
+			// Add PARAMs.
+			if ( editor.config.pluginConfig.flash.embedTagOnly != true )
+				for ( var name in this.changedAttibutes[ 'PARAM' ] ){
+					addParam( this.editObj[ 'object' ], name, this.changedAttibutes[ 'PARAM' ][ name ] );
+				}
 
 			// Set STYLE dimensions.
 			if ( this.dimensionsInStyle[ 'width' ] == true )
 			{
-				this.editObj[ 'object' ].setStyle( 'width',  this.changedAttibutes[ 'OBJECT' ][ 'width' ] + 'px' );
-				this.editObj[ 'fakeobject' ].setStyle( 'width',  this.changedAttibutes[ 'OBJECT' ][ 'width' ] + 'px' );
+				var value = this.changedAttibutes[ 'OBJECT' ][ 'width' ] + 'px';
+				this.editObj[ 'embed' ].setStyle( 'width', value );
+				this.editObj[ 'object' ].setStyle( 'width',  value );
+				this.editObj[ 'fakeobject' ].setStyle( 'width', value );
 			}
 			if ( this.dimensionsInStyle[ 'height' ] == true )
 			{
-				this.editObj[ 'object' ].setStyle( 'height',  this.changedAttibutes[ 'OBJECT' ][ 'height' ] + 'px' );
-				this.editObj[ 'fakeobject' ].setStyle( 'height',  this.changedAttibutes[ 'OBJECT' ][ 'height' ] + 'px' );
+				var value = this.changedAttibutes[ 'OBJECT' ][ 'height' ] + 'px';
+				this.editObj[ 'embed' ].setStyle( 'height', value );
+				this.editObj[ 'object' ].setStyle( 'height', value );
+				this.editObj[ 'fakeobject' ].setStyle( 'height', value );
 			}
 
@@ -324,8 +424,11 @@
 			{
 				// Append EMBED as child.
-				this.editObj[ 'object' ].append( this.editObj[ 'embed' ] );
-				this.editObj[ 'fakeobject' ] = CKEDITOR.plugins.fakeobjects.protectElement( this.editObj[ 'object' ] );
-
-				//alert( decodeURIComponent( this.editObj[ 'fakeobject' ].getAttribute( '_cke_protected_html' ) ));
+				if ( editor.config.pluginConfig.flash.embedTagOnly != true && editor.config.pluginConfig.flash.addEmbedTag )
+					this.editObj[ 'object' ].append( this.editObj[ 'embed' ] );
+
+				if ( editor.config.pluginConfig.flash.embedTagOnly )
+					this.editObj[ 'fakeobject' ] = CKEDITOR.plugins.fakeobjects.protectElement( this.editObj[ 'embed' ] );
+				else
+					this.editObj[ 'fakeobject' ] = CKEDITOR.plugins.fakeobjects.protectElement( this.editObj[ 'object' ] );
 
 				// It doesn't work with IE.
@@ -372,4 +475,5 @@
 											addChange( 'movie', this, PARAM );
 											addChange( 'src', this, EMBED );
+											addChange( 'data', this, OBJECT );
 											return true;
 										},
@@ -587,5 +691,5 @@
 								validate : function()
 								{
-									addChange( 'wmode', this, PARAM );
+									addChange( 'wmode', this, PARAM | EMBED );
 									return true;
 								}
@@ -652,4 +756,15 @@
 					},
 					{
+						type : 'text',
+						id : 'txtFlashvars',
+						label : editor.lang.flash.flashvars,
+						checked : editor.config.pluginConfig.flash.defaultValues.flashvars,
+						validate : function()
+						{
+							addChange( 'flashvars', this, PARAM | EMBED );
+							return true;
+						}
+					},
+					{
 						type : 'checkbox',
 						id : 'chkMenu',
