/**
 * @license Copyright (c) 2003-2012, CKSource - Frederico Knabben. All rights reserved.
 * For licensing, see LICENSE.html or http://ckeditor.com/license
 */

 
 
CKEDITOR.editorConfig = function( config ) {
	// Define changes to default configuration here.
	// For the complete reference:
	// http://docs.ckeditor.com/#!/api/CKEDITOR.config

	//	config.plugins = 'panelbutton,floatpanel,colorbutton';
	// panelbutton, floatpanel, styles';
	

   config.BodyId = "fck-div";

	
	config.extraPlugins = 'font,smiley,panelbutton,floatpanel,colorbutton,colordialog,showblocks,justify,undo,find,selectall,print,preview,newpage';
		
		/*	config.toolbar = [ 
			['Templates', 'Styles','Format','Font','FontSize','TextColor','BGColor','Maximize','Image'], 
			['Source'], 
			['Bold','Italic','Underline','Strike','-','Subscript','Superscript','-','fmath_formula'], 
			['Table','HorizontalRule'], 
			['NumberedList','BulletedList','-','Outdent','Indent','Blockquote']
		    ] 
			*/
	
	
	// The toolbar groups arrangement, optimized for two toolbar rows.
	config.toolbarGroups = [
		{ name: 'clipboard',   groups: [ 'clipboard', 'undo' ] },
		{ name: 'editing',     groups: [ 'find', 'selection', 'spellchecker' ] },
		{ name: 'links' },
		{ name: 'insert' },
		{ name: 'forms' },
		{ name: 'tools' },
		{ name: 'document',	   groups: [ 'mode', 'document', 'doctools' ] },
		{ name: 'others' },
		'/',
		{ name: 'basicstyles', groups: [ 'basicstyles', 'cleanup' ] },
		{ name: 'paragraph',   groups: [ 'list', 'indent', 'blocks', 'align' ] },
		{ name: 'styles' },
		{ name: 'colors' }
		
		
		//{ name: 'styles', items: [ 'Styles', 'Format', 'Font', 'FontSize' ] },
		//{ name: 'colors', items: [ 'TextColor', 'BGColor' ] }
		
		//{ name: 'about' }
	];
	
	config.height = 300;
	config.width = 800; /////// 800
	config.resize_enabled = false;

	// Remove some buttons, provided by the standard plugins, which we don't
	// need to have in the Standard(s) toolbar.
	//config.removeButtons = 'Underline,Subscript,Superscript';
	
	 config.filebrowserBrowseUrl = '../site_02_12_2013_template/ckeditor/kcfinder-2.51/browse.php?type=files';
   //config.filebrowserImageBrowseUrl = '../kcfinder-2.51/browse.php?type=images';
   //config.filebrowserImageBrowseUrl = '';
   
   config.filebrowserFlashBrowseUrl = '../site_02_12_2013_template/ckeditor/kcfinder-2.51/browse.php?type=flash';
   config.filebrowserUploadUrl = '../site_02_12_2013_template/ckeditor/kcfinder-2.51/upload.php?type=files';
   config.filebrowserImageUploadUrl = '../site_02_12_2013_template/ckeditor/kcfinder-2.51/upload.php?type=images';
   config.filebrowserFlashUploadUrl = '../TP/ckeditor/kcfinder-2.51/upload.php?type=flash';
   
	//config.linkShowTargetTab = false; 
  
};


CKEDITOR.on( 'dialogDefinition', function( ev )
   {

   var tab, name = ev.data.name,
			
			definition = ev.data.definition;

			
			//definition.getContents( 'Link' ).hidden=true;	
			
		/*if ( name == 'link' )
		{
			definition.removeContents( 'target' );
			definition.removeContents( 'upload' );
			definition.removeContents( 'advanced' );
			tab = definition.getContents( 'info' );
			tab.remove( 'emailSubject' );
			tab.remove( 'emailBody' );
		}*/
		if ( name == 'image' )
		{
			definition.removeContents( 'advanced' );
			definition.removeContents( 'Link' );
			//tab = definition.getContents( 'Link' );
			//tab.remove( 'cmbTarget' );
			tab = definition.getContents( 'info' );
			//tab.remove( 'txtUrl' );
			//tab.remove( 'ratioLock' );
			//tab.remove( 'txtAlt' );
			//tab.remove( 'txtHeight' );
			//tab.remove( 'txtWidth' );
			//tab.remove( 'txtBorder' );
			//tab.remove( 'txtHSpace' );
			//tab.remove( 'txtVSpace' );
			//tab.remove( 'cmbAlign' );
			// htmlPreview
		}

/**********************************************************
   var dialogDefinition = ev.data.definition;
	  
	     dialogDefinition.removeContents( 'advanced' );
		 dialogDefinition.removeContents( 'target' );
		 dialogDefinition.removeContents( 'Link' );
		
         var infoTab = dialogDefinition.getContents( 'info' );		
		 infoTab.remove( 'txtWidth');
		 infoTab.remove( 'txtHeight');
		 infoTab.remove( 'txtSummary');
		 infoTab.remove( 'txtCaption');
		infoTab.remove( 'cmbAlign');
		infoTab.remove( 'txtBorder');
		infoTab.remove( 'selHeaders');
		infoTab.remove( 'txtCellSpace');
		infoTab.remove( 'txtCellPad'); 

/***********************************************************/
		
   /*   var dialogName = ev.data.name;
      

		 var infoTab = dialogDefinition.getContents( 'info' );

infoTab.remove( 'txtWidth');
infoTab.remove( 'txtHeight');
infoTab.remove( 'txtSummary');
infoTab.remove( 'txtCaption');
infoTab.remove( 'cmbAlign');
infoTab.remove( 'txtBorder');
infoTab.remove( 'selHeaders');
infoTab.remove( 'txtCellSpace');
infoTab.remove( 'txtCellPad'); 
infoTab.remove( 'previewImage');

 dialogDefinition.getContents( 'Link' ).hidden=true;*/
		 
       
	 // dialogDefinition.removeContents( 'info' );
  
  
      // Check if the definition is from the dialog we're
      // interested in (the 'image' dialog). This dialog name found using DevTools plugin
      /*if ( dialogName == 'image' )
      {
         // Remove the 'Link' and 'Advanced' tabs from the 'Image' dialog.
         dialogDefinition.removeContents( 'link' );
         dialogDefinition.removeContents( 'advanced' );
  
         // Get a reference to the 'Image Info' tab.
         var infoTab = dialogDefinition.getContents( 'info' );
  
         // Remove unnecessary widgets/elements from the 'Image Info' tab.        
         infoTab.remove( 'txtHSpace');
         infoTab.remove( 'txtVSpace');
      }*/
	  
	  
	 

	  //infoTab.remove( 'linkType');
     //infoTab.remove( 'protocol');

//var textWidth = infoTab.get('txtWidth');
//textWidth['default'] = '400';

// Remove unnecessary widgets from the 'Table Info' tab.

 

		//var urlField = infoTab.get( 'url' );
         //   urlField['default'] = 'www.example.com';
	  
	//  dialogDefinition.removeContents( 'Link' );
	
	
	  
	 // var linkTab = dialogDefinition.getContents( 'Link' );
     //    linkTab.remove( 'browse' );
     //    linkTab.remove( 'cmbTarget' );
	  
	 // var Tab = dialogDefinition.getContents( 'link' );
	 //  Tab.remove( 'linkType');
      //   Tab.remove( 'protocol');
	  
	  //http://docs.cksource.com/ckeditor_api/symbols/CKEDITOR.dialog.html
	  //http://ckeditor.com/demo#full
	  
	  //http://ckeditor.com/addon/colorbutton

   });

   
   
   
   
   