

tinymce.create('tinymce.plugins.CustomDropDown', {
	createControl: function(n, cm) {
		switch (n) {
			case 'customdropdown': {
			  var c = cm.createMenuButton('customdropdown', {
					title : 'Specifiek dropdown-menu',
					image : 'http://solution-sl.nl/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();

 				});
 				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 : 'Voeg een interne link toe',
					image : 'http://solution-sl.nl/modules/TinyMCE/images/cmsmslink.gif',
					icons : false
				});

				c.onRenderMenu.add(function(c, m) {

					m.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">'+sel+'</a>');
					}});

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

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

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

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

					m.add({title : '6 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>');
					}});

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

					m.add({title : '8 Test', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Test';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="index.php?page=test">'+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://solution-sl.nl/modules/TinyMCE/stylesheet.php?templateid=&mediatype=screen&bogus=1328758043",

    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,advimage,advlink,contextmenu,inlinepopups,paste",

  theme_advanced_buttons1 : "cut,paste,cut,paste,pastetext,pasteword,copy,separator,justifyleft,justifycenter,justifyright,justifyfull,fontselect",
  theme_advanced_buttons2 : "bold,italic,underline,strikethrough,advhr,separator,bullist,numlist,separator,outdent,indent,separator,undo,redo,separator,charmap,separator,forecolor,backcolor,separator,fullscreen,help",  
  theme_advanced_buttons3 : "",

  theme_advanced_blockformats : "p,div,h1,h2,h3,h4,h5,h6,div,blockquote,dt,dd,code,samp",
  document_base_url : "http://solution-sl.nl/",

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

			
		
	force_br_newlines : false,
  force_p_newlines : true,		
			 
  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://solution-sl.nl/modules/TinyMCE/filepicker.php?_s_=&type="+type;
  
  tinyMCE.activeEditor.windowManager.open({
  
    file : cmsURL,
    title : 'CMSMadeSimple Bestandsselectie',
    width : '700',
    height : '500',
    resizable : "yes",
    scrollbars : "yes",
    inline : "yes",      close_previous : "no"
  
  }, {
    window : win,
    input : field_name
  });
  return false;
}



	
