/*
 * FCKeditor - The text editor for Internet - http://www.fckeditor.net
 * Copyright (C) 2003-2007 Frederico Caldeira Knabben
 *
 * == BEGIN LICENSE ==
 *
 * Licensed under the terms of any of the following licenses at your
 * choice:
 *
 *  - GNU General Public License Version 2 or later (the "GPL")
 *    http://www.gnu.org/licenses/gpl.html
 *
 *  - GNU Lesser General Public License Version 2.1 or later (the "LGPL")
 *    http://www.gnu.org/licenses/lgpl.html
 *
 *  - Mozilla Public License Version 1.1 or later (the "MPL")
 *    http://www.mozilla.org/MPL/MPL-1.1.html
 *
 * == END LICENSE ==
 *
 */
 
FCKConfig.Plugins.Add( 'phpbb3' ) ;
//FCKConfig.Plugins.Add( 'placeholder' ) ;

FCKConfig.ToolbarSets["Default"] = [
	['Source'],
	//['Cut','Copy','Paste','PasteText','PasteWord','-','Print','SpellCheck'],
	['Cut','Copy','PasteText'],
	//['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],
	['Undo','Redo','-','Replace','-','SelectAll','RemoveFormat'],
	[],
	'/',
	['Bold','Italic','Underline','Blockquote'],
	['OrderedList','UnorderedList'],
	['Style','FontSize'],
	['TextColor'],
	['About']		// No comma for the last row.
] ;

if ( window.parent.fckUrlStatus )
{
	FCKConfig.ToolbarSets["Default"][3].push('Link') ;
	FCKConfig.ToolbarSets["Default"][3].push('Unlink') ;
}
if ( window.parent.fckImgStatus )
{
	FCKConfig.ToolbarSets["Default"][3].push('Image') ;
}
if ( window.parent.fckFlashStatus )
{
	FCKConfig.ToolbarSets["Default"][3].push('Flash') ;
}

var tableBBcodeCount = 0 ;
for ( var i = 0; i < window.parent.fck_bb_tag.length; i++ )
{
	switch( window.parent.fck_bb_tag[i] )
	{
		case "strike":
			FCKConfig.ToolbarSets["Default"][6].push("StrikeThrough") ;
			break
		case "left":
			FCKConfig.ToolbarSets["Default"][6].push('JustifyLeft') ;
			break
		case "right":
			FCKConfig.ToolbarSets["Default"][6].push('JustifyRight') ;
			break
		case "center":
			FCKConfig.ToolbarSets["Default"][6].push('JustifyCenter') ;
			break
		case "justify":
			FCKConfig.ToolbarSets["Default"][6].push('JustifyFull') ;
			break
		case "sub":
			FCKConfig.ToolbarSets["Default"][6].push("Subscript") ;
			break
		case "sup":
			FCKConfig.ToolbarSets["Default"][6].push("Superscript") ;
			break
		case "hr":
			FCKConfig.ToolbarSets["Default"][3].push('Rule') ;
			break
		case "tableo":
		case "tablec":
		case "tbodyo":
		case "tbodyc":
		case "caption":
		case "tro":
		case "trc":
		case "tdo":
		case "tdc":
			tableBBcodeCount++ ;
			break
		default:
			if ( window.parent.fck_bb_display[i] )
			{
				//FCKConfig.ToolbarSets["Default"][10].push( window.parent.fck_bbcodes[i] ) ;
			}
			break	
	}	
}

if ( tableBBcodeCount == 9 ) 
{
	FCKConfig.ToolbarSets["Default"][3].push('Table') ;
}

FCKConfig.ToolbarSets["Default"][3].push('SpecialChar') ;
if( window.parent.fck_bb_tpl && window.parent.fck_bb_match )
	for ( i=0 ; i < window.parent.fck_bb_tpl.length ; i++ )
		if ( window.parent.fck_bb_tpl[i] == '' )
		{
			FCKConfig.ToolbarSets["Default"][3].push(window.parent.fck_bb_tag[i]) ;	
		}
//FCKConfig.ToolbarSets["Default"][3].push('Placeholder') ;

FCKConfig.EditorAreaCSS = window.parent.fckCss.replace( /&amp;/gi, "&" ) ;
FCKConfig.BaseHref = window.parent.fckBaseHref ;
FCKConfig.FontSizes	= window.parent.fckFontSizes ;
FCKConfig.StylesXmlPath		= FCKConfig.PluginsPath + 'phpbb3/fckstyles.xml' ;
FCKConfig.FormatSource		= false ;
FCKConfig.FormatOutput		= false ;
FCKConfig.EnterMode = 'br' ;
FCKConfig.ShiftEnterMode = 'br' ;
FCKConfig.ForceDivJustify = true;
FCKConfig.PreserveSessionOnFileBrowser = true ;
FCKConfig.ContextMenu = ['Image','Link','Generic','Anchor','Flash','Select','Textarea','Checkbox','Radio','TextField','HiddenField','Button','BulletedList','NumberedList','Table','Form'] ;
FCKConfig.CustomStyles = {};
FCKConfig.LinkDlgHideTarget = true ;
FCKConfig.LinkUpload = false ;
FCKConfig.LinkDlgHideAdvanced = true ;
FCKConfig.DisableObjectResizing = true ;
FCKConfig.DisableFFTableHandles = true ;
FCKConfig.ImageDlgHideLink		= true ;
FCKConfig.ImageDlgHideAdvanced	= true ;
FCKConfig.FlashDlgHideAdvanced	= true ;
FCKConfig.LinkBrowser = false ;
FCKConfig.ImageBrowser = false ;
FCKConfig.FlashBrowser = false ;
FCKConfig.LinkUpload = false ;
FCKConfig.ImageUpload = false ;
FCKConfig.FlashUpload = false ;
FCKConfig.BrowserContextMenuOnCtrl = true ;
