/**
 * $Id: editor_plugin_src.js 520 2008-01-07 16:30:32Z spocke $
 *
 * @author Cees Rijken
 * @copyright www.connectcase.nl
 */

(function() {
	tinymce.PluginManager.requireLangPack('addthis');
	tinymce.create('tinymce.plugins.addthisPlugin', {
		init : function(ed, url) {
			// Register commands
			ed.addCommand('mceAddThis', function() {
				ed.windowManager.open({
					file : url + '/add_this.htm',
					width : 350 + parseInt(ed.getLang('addthis.delta_width', 0)),
					height : 240 + parseInt(ed.getLang('addthis.delta_height', 0)),
					inline : 1
				}, {
					plugin_url : url
				});
			});

			ed.addCommand('mceAddThisDelete', function() 
      {
      var gdoc = ed.getDoc();
      ed.dom.remove(gdoc.getElementById('spanaddthis'));
			});

      	ed.addButton('addthis', {
				title : 'addthis.desc',
				cmd : 'mceAddThis',
				image : url + '/img/add_this.gif'
			});

		},

		getInfo : function() {
			return {
				longname : 'Addthis plugin',
				author : 'Pedro Pinto',
				authorurl : 'http://www.goweb.pt',
				infourl : 'http://www.goweb.pt',
				version : tinymce.majorVersion + "." + tinymce.minorVersion
			};
		}
	});

	// Register plugin
	tinymce.PluginManager.add('addthis', tinymce.plugins.addthisPlugin);
})();