

tinymce.create('tinymce.plugins.CustomDropDown', {
	createControl: function(n, cm) {
		switch (n) {
			case 'customdropdown': {
			  var c = cm.createMenuButton('customdropdown', {
					title : 'Custom dropdown-menu',
					image : 'http://thegoldcoastbar.com/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}');
					}});
  					m.addSeparator();
  	  				m.add({title : 'Insert Smarty {literal} around selection', onclick : function() {
              var sel=tinyMCE.activeEditor.selection.getContent();
	  					tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{literal}'+sel+'{/literal}');
					}});

 				});
 				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 : 'Insert link to cmsms-page',
					image : 'http://thegoldcoastbar.com/modules/TinyMCE/images/cmsmslink.gif',
					icons : false
				});

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

					m.add({title : '1 About the gold coast restaurant', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='About the gold coast restaurant';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="http://thegoldcoastbar.com/about-the-gold-coast-restaurant.php">'+sel+'</a>');
					}});

					m.add({title : '2 eating at gold coast', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='eating at gold coast';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="http://thegoldcoastbar.com/eating-at-the-gold-coast-restaurant.php">'+sel+'</a>');
					}});

					m.add({title : '3 drinking', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='drinking';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="http://thegoldcoastbar.com/drinking-at-the-gold-coast-restaurant.php">'+sel+'</a>');
					}});

					m.add({title : '4 Products', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Products';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="http://thegoldcoastbar.com/the-gold-coast-restaurants-original-recipe-products.php">'+sel+'</a>');
					}});

					m.add({title : '5 Events', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Events';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="http://thegoldcoastbar.com/events-at-the-gold-coast-restaurant.php">'+sel+'</a>');
					}});

					m.add({title : '6 Book your table', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Book your table';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="http://thegoldcoastbar.com/book-your-gold-coast-table-now.php">'+sel+'</a>');
					}});

					m.add({title : '7 the gold coast news and headlines', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='the gold coast news and headlines';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="http://thegoldcoastbar.com/the-gold-coast-news-and-headlines.php">'+sel+'</a>');
					}});

					m.add({title : '8 the gold coast loyalty card', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='the gold coast loyalty card';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="http://thegoldcoastbar.com/the-gold-coast-loyalty-card.php">'+sel+'</a>');
					}});
					var mm = m.addMenu({title : '9 contact the gold coast restaurant'});

					mm.add({title : '9 contact the gold coast restaurant', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='contact the gold coast restaurant';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="http://thegoldcoastbar.com/contact-the-gold-coast-restaurant.php">'+sel+'</a>');
					}});
					mm.addSeparator();

					mm.add({title : '9.1 Home', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Home';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '<a href="http://thegoldcoastbar.com/contact-the-gold-coast-restaurant/home.php">'+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 : "",
  body_class : "CMSMSBody",
  content_css : "http://thegoldcoastbar.com/modules/TinyMCE/stylesheet.php?templateid=23&amp;mediatype=screen&amp;bogus=1284027235",

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

		
  theme : "advanced",
  skin : "default",
  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,
  paste_remove_spans : true,
  paste_remove_styles : 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,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://thegoldcoastbar.com/",

  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 : false,
  force_p_newlines : true,		
			 
  forced_root_block : false,		
		
  plugin_insertdate_dateFormat : "%Y-%m-%d",
  plugin_insertdate_timeFormat : "%H:%M:%S"



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

  