﻿/**
 * jQuery.wysiwyg_override - call different editors with default parameters using base $(el).wysiwyg() call
 * Written by Israel Alvarez (is AT metrob DOT us)
 * Licensed under the WTFPL (http://sam.zoy.org/wtfpl/).
 * Date: 01/25/2010
 *
 * @author Israel Alvarez
 * @version 1.0.0
 *
 **/

/* This program is free software. It comes without any warranty, to
 * the extent permitted by applicable law. You can redistribute it
 * and/or modify it under the terms of the Do What The Fuck You Want
 * To Public License, Version 2, as published by Sam Hocevar. See
 * http://sam.zoy.org/wtfpl/COPYING for more details. */

// wrap in anonymous function to avoid conflict
(function($){

	//Attach this new method to jQuery
 	$.fn.extend({ 
 	
 		//wysiwyg_editor: function(config) {
 		wysiwyg: function(config) {
			
			var default_config = {
				toolbar:
					[
						['Source'],
	    				['Cut','Copy','Paste','PasteText','PasteFromWord','-','Print', 'SpellChecker', 'Scayt'],['Maximize', 'ShowBlocks'],
	    				['Undo','Redo','-','Find','Replace','-','SelectAll','RemoveFormat'],['Link','Unlink','Anchor'],['Image','Table','HorizontalRule','SpecialChar'],
	    				'/',
	    				['Bold','Italic','Underline','Strike','-','Subscript','Superscript'],
	    				['NumberedList','BulletedList','-','Outdent','Indent','Blockquote'],
	    				['JustifyLeft','JustifyCenter','JustifyRight','JustifyBlock']
	    				
					],width: '100%',height: '500px',toolbarStartupExpanded:true,toolbarLocation: 'top'
			};

			var nuconfig = $.extend(default_config,config);

			//Iterate over the current set of matched elements
    		return this.each(function() {
				//code to be inserted here
				/*
				if(('toolbarStartupExpanded' in config) && (config.toolbarStartupExpanded)) {
					nuconfig.toolbarStartupExpanded = true;
				} else {
					nuconfig.toolbarStartupExpanded = false;
				}
				*/
				$("#"+this.id).ckeditor(nuconfig);
    		});
    	}
	});
	
//pass jQuery to the function	
})(jQuery);