// ----------------------------------------------------------------------------
// markItUp!
// ----------------------------------------------------------------------------
// Copyright (C) 2008 Jay Salvat
// http://markitup.jaysalvat.com/
// ----------------------------------------------------------------------------
// BBCode tags example
// http://en.wikipedia.org/wiki/Bbcode
// ----------------------------------------------------------------------------
// Feel free to add more tags
// ----------------------------------------------------------------------------
markItUpSettingsBBCode = {
	className: "bbcode",
	previewParserPath: "", // path to your BBCode parser
	markupSet: [
		{name: "Bold", className: "bold", key: "B", openWith: "[b]", closeWith: "[/b]"},
		{name: "Italic", className: "italic", key: "I", openWith: "[i]", closeWith: "[/i]"},
		//{name: "Underline", className: "underline", key: "U", openWith: "[u]", closeWith: "[/u]"},
		{name: "Strikethrough", className: "strikethrough", key: "S", openWith: "[s]", closeWith: "[/s]"},
		{separator: true},
		/*{name: "Size", className: "font", key: "S", openWith: "[size=[![Text size]!]]", closeWith: "[/size]",
		dropMenu: [
			{name: "Big", openWith: "[size=200]", closeWith: "[/size]"},
			{name: "Normal", openWith: "[size=100]", closeWith: "[/size]"},
			{name: "Small", openWith: "[size=50]", closeWith: "[/size]"}
		]},*/
		{name: "Colour", className: "palette", dropMenu: [
			{name: "Yellow", openWith: "[color=yellow]", closeWith: "[/color]", className: "col1-1"},
			{name: "Yellow", openWith: "[color=#edd400]", closeWith: "[/color]", className: "col1-2"},
			{name: "Yellow", openWith: "[color=#c4a000]", closeWith: "[/color]", className: "col1-3"},

			{name: "Orange", openWith: "[color=#fcaf3e]", closeWith: "[/color]", className: "col2-1"},
			{name: "Orange", openWith: "[color=#f57900]", closeWith: "[/color]", className: "col2-2"},
			{name: "Orange", openWith: "[color=#ce5c00]", closeWith: "[/color]", className: "col2-3"},

			{name: "Brown", openWith: "[color=#e9b96e]", closeWith: "[/color]", className: "col3-1"},
			{name: "Brown", openWith: "[color=#c17d11]", closeWith: "[/color]", className: "col3-2"},
			{name: "Brown", openWith: "[color=#8f5902]", closeWith: "[/color]", className: "col3-3"},

			{name: "Green", openWith: "[color=#8ae234]", closeWith: "[/color]", className: "col4-1"},
			{name: "Green", openWith: "[color=#73d216]", closeWith: "[/color]", className: "col4-2"},
			{name: "Green", openWith: "[color=#4e9a06]", closeWith: "[/color]", className: "col4-3"},

			{name: "Blue", openWith: "[color=#729fcf]", closeWith: "[/color]", className: "col5-1"},
			{name: "Blue", openWith: "[color=#3465a4]", closeWith: "[/color]", className: "col5-2"},
			{name: "Blue", openWith: "[color=#204a87]", closeWith: "[/color]", className: "col5-3"},

			{name: "Purple", openWith: "[color=#ad7fa8]", closeWith: "[/color]", className: "col6-1"},
			{name: "Purple", openWith: "[color=#75507b]", closeWith: "[/color]", className: "col6-2"},
			{name: "Purple", openWith: "[color=#5c3566]", closeWith: "[/color]", className: "col6-3"},

			{name: "Red", openWith: "[color=red]", closeWith: "[/color]", className: "col7-1"},
			{name: "Red", openWith: "[color=#cc0000]", closeWith: "[/color]", className: "col7-2"},
			{name: "Red", openWith: "[color=#a40000]", closeWith: "[/color]", className: "col7-3"},

			{name: "Gray", openWith: "[color=#ffffff]", closeWith: "[/color]", className: "col8-1"},
			{name: "Gray", openWith: "[color=#d3d7cf]", closeWith: "[/color]", className: "col8-2"},
			{name: "Gray", openWith: "[color=#babdb6]", closeWith: "[/color]", className: "col8-3"},

			{name: "Gray", openWith: "[color=#888a85]", closeWith: "[/color]", className: "col9-1"},
			{name: "Gray", openWith: "[color=#555753]", closeWith: "[/color]", className: "col9-2"},
			{name: "Gray", openWith: "[color=#000000]", closeWith: "[/color]", className: "col9-3"}
		]},
		{separator: true},
		{name: "Bulleted list", className: "list-bullet", prependLine: "*", replaceWith: function(markitup) { var str = markitup.textarea.value.replace(/(\r\n|\r)/g, "\n"), str2 = markitup.selectedText.replace(/(\r\n|\r)/g, "\n"), i = str.lastIndexOf("\n", markitup.selectionStart - 1); markitup.textarea.value = (str.substring(0, i + 1) + "*" + str.substring(i + 1, markitup.selectionStart + str2.length).replace(/(\r\n|\r|\n)/g, "\r\n*") + str.substring(markitup.selectionStart + str2.length)).replace(/(\r\n|\r|\n)/g, "\r\n"); markitup.select(markitup.selectionStart + 1, str2.replace(/(\r\n|\r|\n)/g, "\n*").length);}},
		{name: "Numeric list", className: "list-numeric", prependLine: "#", replaceWith: function(markitup) { var str = markitup.textarea.value.replace(/(\r\n|\r)/g, "\n"), str2 = markitup.selectedText.replace(/(\r\n|\r)/g, "\n"), i = str.lastIndexOf("\n", markitup.selectionStart - 1); markitup.textarea.value = (str.substring(0, i + 1) + "#" + str.substring(i + 1, markitup.selectionStart + str2.length).replace(/(\r\n|\r|\n)/g, "\r\n#") + str.substring(markitup.selectionStart + str2.length)).replace(/(\r\n|\r|\n)/g, "\r\n"); markitup.select(markitup.selectionStart + 1, str2.replace(/(\r\n|\r|\n)/g, "\n#").length);}},
		//{name: "List item", className: "list-item", openWith: "[*] "},
		{separator: true},
		{name: "Quote", className: "quote", openWith: "[quote]", closeWith: "[/quote]"},
		{name: "Code", className: "code", openWith: "[code]", closeWith: "[/code]"},
		//{separator: true},
		//{name: "Image", className: "image", key: "P", replaceWith: "[img][![Url]!][/img]"},
		//{name: "Link", className: "link", key: "L", openWith: "[url=[![Url]!]]", closeWith: "[/url]", placeHolder: "Your text to link here..."},
		{separator: true},
		{name: "Remove tags from selection", className: "remove-tags", replaceWith: function(markitup) { return markitup.selection.replace(/\[(.*?)\]/g, "");}},
		//{name: "Preview", className: "preview", call: "preview"}
	]
};
