// ----------------------------------------------------------------------------
// 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
// ----------------------------------------------------------------------------

$.miuSpellchecker = function(markitup, lang) {
	$.initSpellChecker(markitup.textarea, lang);
}

$.initSpellChecker = function(markTxt, lang) {	

	if ($(markTxt).hasClass("spellcheck-editor")) {
	    $(markTxt).spellchecker("remove");
	} else {
	    $(markTxt)
	    .spellchecker({
	        engine: "pspell",
	        url: "jquery/jquery-spellchecker/checkspelling.php",
	        wordlist: {action: "after", element: ".markItUpFooter"},
	        lang: lang,
	        suggestBoxPosition: "above"
	    })
	    .spellchecker("check", function(result){
	        if (result) {
	        	$(markTxt).spellchecker("remove");
	        }
	        $.spellerCallback(result);
	    });
	}
}

mySettings = {
	previewParserPath:	'', // path to your BBCode parser
	markupSet: [
		{name:'Gras', key:'G', openWith:'[b]', closeWith:'[/b]'},
		{name:'Italique', key:'I', openWith:'[i]', closeWith:'[/i]'},
		{name:'Sousligné', key:'U', openWith:'[u]', closeWith:'[/u]'},
		{name:'Barré', key:'B', openWith:'[s]', closeWith:'[/s]'},
		{name:'super', key:'1', openWith:'[sup]', closeWith:'[/sup]'},
		{name:'sub', key:'2', openWith:'[sub]', closeWith:'[/sub]'},
		{separator:'---------------' },
		{name:'Police', key:'F', openWith:'[font=[![Police]!]]', closeWith:'[/font]',
		dropMenu :[
			{name:'Arial', openWith:'[font=Arial]', closeWith:'[/font]' },
			{name:'Comic', openWith:'[font=Comic Sans MS]', closeWith:'[/font]' },
			{name:'Courier', openWith:'[font=Courier New]', closeWith:'[/font]' },
			{name:'Georgia', openWith:'[font=Georgia]', closeWith:'[/font]' },
			{name:'Lucida', openWith:'[font=Lucida Console]', closeWith:'[/font]' },
			{name:'Verdana', openWith:'[font=Verdana]', closeWith:'[/font]' }
			
		]},
		{name:'Taille', key:'T', openWith:'[size=[![Taille du texte]!]]', closeWith:'[/size]',
		dropMenu :[
			{name:'Gros', openWith:'[size=5]', closeWith:'[/size]' },
			{name:'Normal', openWith:'[size=3]', closeWith:'[/size]' },
			{name:'Petit', openWith:'[size=1]', closeWith:'[/size]' }
		]},
        {name:'Couleur', openWith:'[color=[![Couleur]!]]', closeWith:'[/color]', className:'colors', dropMenu: [
            {name:'Jaune',  openWith:'[color=#FCE94F]', closeWith:'[/color]', className:"col1-1" },
            {name:'Jaune',  openWith:'[color=#EDD400]', closeWith:'[/color]', className:"col1-2" },
            {name:'Jaune',  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:'Brun',   openWith:'[color=#E9B96E]', closeWith:'[/color]', className:"col3-1" },
            {name:'Brun',   openWith:'[color=#C17D11]', closeWith:'[/color]', className:"col3-2" },
            {name:'Brun',   openWith:'[color=#8F5902]', closeWith:'[/color]', className:"col3-3" },
            {name:'Vert',   openWith:'[color=#8AE234]', closeWith:'[/color]', className:"col4-1" },
            {name:'Vert',   openWith:'[color=#73D216]', closeWith:'[/color]', className:"col4-2" },
            {name:'Vert',   openWith:'[color=#4E9A06]', closeWith:'[/color]', className:"col4-3" },
            {name:'Bleu',    openWith:'[color=#729FCF]', closeWith:'[/color]', className:"col5-1" },
            {name:'Bleu',    openWith:'[color=#3465A4]', closeWith:'[/color]', className:"col5-2" },
            {name:'Bleu',    openWith:'[color=#204A87]', closeWith:'[/color]', className:"col5-3" },
            {name:'Mauve',  openWith:'[color=#AD7FA8]', closeWith:'[/color]', className:"col6-1" },
            {name:'Mauve',  openWith:'[color=#75507B]', closeWith:'[/color]', className:"col6-2" },
            {name:'Mauve',  openWith:'[color=#5C3566]', closeWith:'[/color]', className:"col6-3" },
            {name:'Rouge',     openWith:'[color=#EF2929]', closeWith:'[/color]', className:"col7-1" },
            {name:'Rouge',     openWith:'[color=#CC0000]', closeWith:'[/color]', className:"col7-2" },
            {name:'Rouge',     openWith:'[color=#A40000]', closeWith:'[/color]', className:"col7-3" },
            {name:'Gris',    openWith:'[color=#FFFFFF]', closeWith:'[/color]', className:"col8-1" },
            {name:'Gris',    openWith:'[color=#D3D7CF]', closeWith:'[/color]', className:"col8-2" },
            {name:'Gris',    openWith:'[color=#BABDB6]', closeWith:'[/color]', className:"col8-3" },
            {name:'Gris',    openWith:'[color=#888A85]', closeWith:'[/color]', className:"col9-1" },
            {name:'Gris',    openWith:'[color=#555753]', closeWith:'[/color]', className:"col9-2" },
            {name:'Gris',    openWith:'[color=#000000]', closeWith:'[/color]', className:"col9-3" }
        ]},
		{separator:'---------------' },
		{name:'Image', key:'P', openWith:'[img]', closeWith:'[/img]', placeHolder:'Mettre votre lien ici'},
		{name:'Lien', key:'L', openWith:'[url=[![URL]!]]', closeWith:'[/url]', placeHolder:'Nom du site'},
		{name:'Courriel', key:'E', openWith:'[email]', closeWith:'[/email]', placeHolder:'Mettre l\'adresse ici'},
		{name:'Musique', key:'3', openWith:'[mp3]', closeWith:'[/mp3]', placeHolder:'Mettre votre lien ici'},
		{separator:'---------------' },
		{name:'Aligner au centre', key:'H', openWith:'[center]', closeWith:'[/center]'},
		{name:'Aligner ˆ droite', key:'D', openWith:'[right]', closeWith:'[/right]'},
		{name:'Justifier', key:'J', openWith:'[justifier]', closeWith:'[/justifier]'},
		{separator:'---------------' },
		{name:'Citation', openWith:'[citation=[![Citation de]!]]', closeWith:'[/citation]', placeHolder:'Mettre la citation ici'},
		{
	        name: 'Spellcheck', 
	        className: 'spellcheck', 
	        beforeInsert: function(markitup) { 
	        	$.miuSpellchecker(markitup, "fr"); 
	        } 
		}
//		{name:'Bulleted list', openWith:'[list]\n', closeWith:'\n[/list]'},
//		{name:'Numeric list', openWith:'[list=[![Starting number]!]]\n', closeWith:'\n[/list]'}, 
//		{name:'List item', openWith:'[*] '},
//		{separator:'---------------' },

//		{separator:'---------------' },
//		{name:'Clean', className:"clean", replaceWith:function(markitup) { return markitup.selection.replace(/\[(.*?)\]/g, "") } },
//		{name:'Preview', className:"preview", call:'preview' }
	]
}
