

tinymce.create('tinymce.plugins.CustomDropDown', {
	createControl: function(n, cm) {
		switch (n) {
			case 'customdropdown': {
			  var c = cm.createMenuButton('customdropdown', {
					title : 'Custom dropdown-menu',
					image : 'http://hitechplastics.net/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 : 'Insert link to cmsms-page',
					image : 'http://hitechplastics.net/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, '{cms_selflink page="home-page" text="'+sel+'"}');
					}});
					var mm = m.addMenu({title : '2 ABOUT US'});

					mm.add({title : '2 ABOUT US', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='ABOUT US';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="about-us" text="'+sel+'"}');
					}});
					mm.addSeparator();

					mm.add({title : '2.1 The Company', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='The Company';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="the-company" text="'+sel+'"}');
					}});

					mm.add({title : '2.2 Management', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Management';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="management" text="'+sel+'"}');
					}});

					mm.add({title : '2.3 Vision', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Vision';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="vision" text="'+sel+'"}');
					}});

					mm.add({title : '2.4 Technology', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Technology';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="technology-2" text="'+sel+'"}');
					}});

					mm.add({title : '2.5 Social Concerns Certificates', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Social Concerns Certificates';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="social-concerns-certificates" text="'+sel+'"}');
					}});

					mm.add({title : '2.7 Media Coverage', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Media Coverage';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="media-coverage" text="'+sel+'"}');
					}});
					var mm = m.addMenu({title : '3 TECHNOLOGY'});

					mm.add({title : '3 TECHNOLOGY', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='TECHNOLOGY';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="technology" text="'+sel+'"}');
					}});
					mm.addSeparator();

					mm.add({title : '3.1 VCI Technology', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='VCI Technology';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="vcl-technology" text="'+sel+'"}');
					}});
					var mm = m.addMenu({title : '4 SERVICES'});

					mm.add({title : '4 SERVICES', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='SERVICES';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="services-2" text="'+sel+'"}');
					}});
					mm.addSeparator();

					mm.add({title : '4.1 Packaging Contracts', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Packaging Contracts';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="packaging-contracts" text="'+sel+'"}');
					}});

					mm.add({title : '4.2 Testing', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Testing';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="testing" text="'+sel+'"}');
					}});

					mm.add({title : '4.3 Corrosion Audits', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Corrosion Audits';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="corrosion-audits" text="'+sel+'"}');
					}});

					mm.add({title : '4.4 Consultancy', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Consultancy';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="consultancy" text="'+sel+'"}');
					}});
					var mm = m.addMenu({title : '6 OUR PRODUCTS'});

					mm.add({title : '6 OUR PRODUCTS', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='OUR PRODUCTS';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="our-products" text="'+sel+'"}');
					}});
					mm.addSeparator();

					mm.add({title : '6.1 Steel Mills', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Steel Mills';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="steel-mills" text="'+sel+'"}');
					}});

					mm.add({title : '6.2 Industrial Lubricants', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Industrial Lubricants';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="industrial-lubricants" text="'+sel+'"}');
					}});

					mm.add({title : '6.3 VCI Products', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='VCI Products';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="vcl-products" text="'+sel+'"}');
					}});

					mm.add({title : '6.4 VCl Papers', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='VCl Papers';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="vcl-papers" text="'+sel+'"}');
					}});

					mm.add({title : '6.5 Metal Working Fluids', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Metal Working Fluids';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="fibc" text="'+sel+'"}');
					}});

					mm.add({title : '6.6 Specialized Polymer Films', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Specialized Polymer Films';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="specialized-polymer-films" text="'+sel+'"}');
					}});

					mm.add({title : '6.7 Other Products', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Other Products';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="other-products" text="'+sel+'"}');
					}});
					var mm = m.addMenu({title : '7 KNOWLEDGE CENTER'});

					mm.add({title : '7 KNOWLEDGE CENTER', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='KNOWLEDGE CENTER';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="knowledge-center" text="'+sel+'"}');
					}});
					mm.addSeparator();

					mm.add({title : '7.1 Case Studies', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Case Studies';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="case-studies" text="'+sel+'"}');
					}});

					mm.add({title : '7.2 Packaging Design', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Packaging Design';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="packaging-design" text="'+sel+'"}');
					}});

					mm.add({title : '7.3 Rust Life Cycle', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Rust Life Cycle';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="rust-life-cycle" text="'+sel+'"}');
					}});
					var mm = m.addMenu({title : '8 CONTACT US'});

					mm.add({title : '8 CONTACT US', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='CONTACT US';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="contact-us-2" text="'+sel+'"}');
					}});
					mm.addSeparator();

					mm.add({title : '8.1 Locate Us', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Locate Us';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="locate-us-2" text="'+sel+'"}');
					}});

					mm.add({title : '8.2 Enquiry', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Enquiry';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="enquiry" text="'+sel+'"}');
					}});

					mm.add({title : '8.4 Marketing Network india', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Marketing Network india';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="marketing-network-india" text="'+sel+'"}');
					}});

					mm.add({title : '8.5 Marketing Network Abroad', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Marketing Network Abroad';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="marketing-network-abroad" text="'+sel+'"}');
					}});
					var mm = m.addMenu({title : '9 DOWNLOAD'});

					mm.add({title : '9 DOWNLOAD', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='DOWNLOAD';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="download" text="'+sel+'"}');
					}});
					mm.addSeparator();

					mm.add({title : '9.1 Brochures', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Brochures';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="brochures" text="'+sel+'"}');
					}});

					mm.add({title : '9.2 Technical Datasheets', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Technical Datasheets';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="technical-datasheets" text="'+sel+'"}');
					}});

					mm.add({title : '9.3 Rust Preventive Oil Selection', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Rust Preventive Oil Selection';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="oil-selection-chart" text="'+sel+'"}');
					}});
					var mm = m.addMenu({title : '10 JOIN RUST-X'});

					mm.add({title : '10 JOIN RUST-X', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='JOIN RUST-X';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="join-rust-x" text="'+sel+'"}');
					}});
					mm.addSeparator();

					mm.add({title : '10.1 Dealership', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Dealership';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="dealership" text="'+sel+'"}');
					}});

					mm.add({title : '10.2 Work For Us', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Work For Us';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="work-for-us" text="'+sel+'"}');
					}});

					mm.add({title : '10.3 Blog', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Blog';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="blog-2" text="'+sel+'"}');
					}});
					var mm = m.addMenu({title : '11 Site Map'});

					mm.add({title : '11 Site Map', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Site Map';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="site-map" text="'+sel+'"}');
					}});
					mm.addSeparator();

					mm.add({title : '11.1 Blog', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='Blog';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="blog" text="'+sel+'"}');
					}});

					m.add({title : '12 disclaimer', onclick : function() {
						var sel=tinyMCE.activeEditor.selection.getContent();
						if (sel=='') sel='disclaimer';
						tinyMCE.activeEditor.execCommand('mceInsertContent', false, '{cms_selflink page="disclaimer" text="'+sel+'"}');
					}});

				});

				// 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://hitechplastics.net/modules/TinyMCE/stylesheet.php?templateid=&mediatype=screen&bogus=1328761634",

    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,visualchars,contextmenu,advimage,fullpage,media,template,searchreplace,directionality,print,nonbreaking,advlink,fullscreen,inlinepopups,insertdatetime,style,xhtmlxtras,table",

  theme_advanced_buttons1 : "cut,paste,pastetext,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 : "tablecontrols",

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

  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",			

			

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



	
