

tinymce.create('tinymce.plugins.CustomDropDown', {
	createControl: function(n, cm) {
		switch (n) {
			case 'customdropdown': {
			  var c = cm.createMenuButton('customdropdown', {
					title : 'Dropdown personnalis\351',
					image : 'http://polenord.asso.fr/modules/TinyMCE/images/customdropdown.gif',
					icons : false
				});
				c.onRenderMenu.add(function(c, m) {				
  					m.add({title : 'Start expand/collapse-area', onclick : function() {
	  					tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{startExpandCollapse id=\'expand1\' title=\'This is my expandable area\'}');
					}});
  					m.add({title : 'End expand/collapse-area', onclick : function() {
	  					tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{stopExpandCollapse}');
					}});
  					m.addSeparator();
  					m.add({title : 'Insert CMS version info', onclick : function() {
	  					tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_version} {cms_versionname}');
					}});

 				});
 				return c;
			}			
		}
		return null;
		
	}
});
// Register plugin with a short name

tinymce.PluginManager.add('customdropdown', tinymce.plugins.CustomDropDown);

		
//Creates a new plugin class and a custom listbox
tinymce.create('tinymce.plugins.CMSLinkerPlugin', {
	createControl: function(n, cm) {	
		switch (n) {
			case 'cmslinker':			
				var c = cm.createMenuButton('cmslinker', {
					title : 'Inserer le lien vers une page cmsms',
					image : 'http://polenord.asso.fr/modules/TinyMCE/images/cmsmslink.gif',
					icons : false
				});

				c.onRenderMenu.add(function(c, m) {
					var mm = m.addMenu({title : '1 Home'});

					mm.add({title : '1 Home', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Home';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=home-2">'+sel+'</a>');
					}});
					mm.addSeparator();

					mm.add({title : '1.2 Prochaines activités', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Prochaines activités';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=activitees-a-venir-2">'+sel+'</a>');
					}});

					mm.add({title : '1.3 Actualités de l&#039;association', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Actualités de l&#039;association';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=information-association-2">'+sel+'</a>');
					}});

					mm.add({title : '2.1 Activitées à  venir', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Activitées à  venir';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=activitees-a-venir">'+sel+'</a>');
					}});

					mm.add({title : '2.2 Information Association', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Information Association';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=information-association">'+sel+'</a>');
					}});
					var mm = m.addMenu({title : '3 Vie du Groupe'});

					mm.add({title : '3 Vie du Groupe', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Vie du Groupe';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=vie-du-groupe">'+sel+'</a>');
					}});
					mm.addSeparator();

					mm.add({title : '3.1 Etat d&#039;esprit', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Etat d&#039;esprit';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=etat-d-esprit">'+sel+'</a>');
					}});

					mm.add({title : '3.2 Histoire du groupe', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Histoire du groupe';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=histoire-du-groupe">'+sel+'</a>');
					}});

					mm.add({title : '3.3 Devenir Membre ?', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Devenir Membre ?';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=devenir-membre">'+sel+'</a>');
					}});
					var mm = m.addMenu({title : '4 Matos'});

					mm.add({title : '4 Matos', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Matos';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=matos">'+sel+'</a>');
					}});
					mm.addSeparator();

					mm.add({title : '4.1 Bache', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Bache';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=bache">'+sel+'</a>');
					}});

					mm.add({title : '4.2 Echarpe', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Echarpe';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=echarpe">'+sel+'</a>');
					}});

					mm.add({title : '4.3 Tee Shirt', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Tee Shirt';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=tee-shirt">'+sel+'</a>');
					}});

					mm.add({title : '4.4 Sweat - Veste', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Sweat - Veste';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=sweat---veste">'+sel+'</a>');
					}});

					mm.add({title : '4.5 Autre', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Autre';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=autre">'+sel+'</a>');
					}});
					var mm = m.addMenu({title : '8 Newsletter'});

					mm.add({title : '8 Newsletter', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Newsletter';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=newsletter">'+sel+'</a>');
					}});
					mm.addSeparator();

					mm.add({title : '8.1 Inscription Newsletter', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Inscription Newsletter';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=inscription-newsletter">'+sel+'</a>');
					}});

					mm.add({title : '8.3 Désinscription Newsletter', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Désinscription Newsletter';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=desinscription-newsletter">'+sel+'</a>');
					}});
					var mm = m.addMenu({title : '9 Forum'});

					mm.add({title : '9 Forum', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Forum';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=forum-2">'+sel+'</a>');
					}});
					mm.addSeparator();

					mm.add({title : '9.1 Forum', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Forum';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=forum">'+sel+'</a>');
					}});
					var mm = m.addMenu({title : '10 Annuaire'});

					mm.add({title : '10 Annuaire', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Annuaire';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=annuaire">'+sel+'</a>');
					}});
					mm.addSeparator();

					mm.add({title : '10.1 Proposer une adresse', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Proposer une adresse';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=proposer-une-adresse">'+sel+'</a>');
					}});

					m.add({title : '11 Contact', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Contact';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=contact">'+sel+'</a>');
					}});

				});

				// Return the new menu button instance
				return c;
		}

		return null;
	}
});

// Register plugin with a short name
tinymce.PluginManager.add('cmslinker', tinymce.plugins.CMSLinkerPlugin);
		 tinyMCE.init({ 
    mode : "exact",
  elements : "",
  content_css : "http://polenord.asso.fr/modules/TinyMCE/stylesheet.php?templateid=&mediatype=screen&bogus=1268656105",

    entity_encoding : "raw", 
  button_tile_map : true, //performance update

		
  theme : "advanced",
  skin : "o2k7",
  skin_variant : "",
  theme_advanced_toolbar_location : "top",
  theme_advanced_toolbar_align : "left",
  visual : true,
	      
  accessibility_warnings : false,
      			
  fix_list_elements : true,
  verify_html : true,
  verify_css_classes : false,
  
  plugins : "-cmslinker,-customdropdown,paste,advimage,advlink,contextmenu,inlinepopups",

    paste_auto_cleanup_on_paste : true,
  
  theme_advanced_buttons1 : "cut,paste,pastetext,pasteword,copy,separator,justifyleft,justifycenter,justifyright,justifyfull,separator,styleselect,formatselect,fontselect,fontsizeselect",
  theme_advanced_buttons2 : "bold,italic,underline,strikethrough,advhr,separator,bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,customdropdown,cmslinker,link,unlink,anchor,image,charmap,cleanup,separator,forecolor,backcolor,separator,code,fullscreen,help",
  theme_advanced_buttons3 : "",
  theme_advanced_buttons4 : "",


  theme_advanced_blockformats : "p,div,h1,h2,h3,h4,h5,h6,div,blockquote,dt,dd,code,samp",
  document_base_url : "http://polenord.asso.fr/",

  relative_urls : true,
  remove_script_host : true,
  	
  language: "en",
  dialog_type: "modal",
  apply_source_formatting : true,

  theme_advanced_statusbar_location : 'bottom',
  theme_advanced_path : true,
			
		
	force_br_newlines : true,
  force_p_newlines : false,		
			 
  forced_root_block : false,		
		
  plugin_insertdate_dateFormat : "%Y-%m-%d",
  plugin_insertdate_timeFormat : "%H:%M:%S",			

			


    file_browser_callback : 'CMSMSFilePicker'
    
});
  
	
  
function toggleEditor(id) {
  if (!tinyMCE.getInstanceById(id))
    tinyMCE.execCommand('mceAddControl', false, id);
  else
    tinyMCE.execCommand('mceRemoveControl', false, id);
}
  

    
function CMSMSFilePicker (field_name, url, type, win) {
     
  var cmsURL = "http://polenord.asso.fr/modules/TinyMCE/filepicker.php?&type="+type;
  
  tinyMCE.activeEditor.windowManager.open({
  
    file : cmsURL,
    title : 'Fichiers CMSMadeSimple',
    width : '700',
    height : '500',
    resizable : "yes",
    scrollbars : "yes",
    inline : "yes",      close_previous : "no"
  
  }, {
    window : win,
    input : field_name
  });
  return false;
}

