
var EditorSubtitular = new Class({
	Extends: nawte,
	
	initialize: function(element, list, options){
		this.parent(element, list, options);
		this.addFunction('<img src="/images/iconos/text_bold.png" width="16" height="16" alt="Negrita" class="cargatipgrande" id="botoneditornegrita">', function() {
			selection = this.getSelection();
			if (selection == "") {
				this.replaceSelection("<b></b>");
			}
			else {
				this.insert("<b>", "before", false); 
				this.insert("</b>", "after", true); //now isLast is set to true, because it is the last one!
			}
		});
		this.addFunction('<img src="/images/iconos/text_italic.png" width="16" height="16" alt="It&aacute;lica" class="cargatipgrande" id="botoneditoritalica">', function() {
			selection = this.getSelection();
			if (selection == "") {
				this.replaceSelection("<i></i>");
			}
			else {
				this.insert("<i>", "before", false); 
				this.insert("</i>", "after", true); 
			}
		});
		this.addFunction('<img src="/images/iconos/text_underline.png" width="16" height="16" alt="Underline" class="cargatipgrande" id="botoneditorsubrayado">', function() {
			selection = this.getSelection();
			if (selection == "") {
				this.replaceSelection("<u></u>");
			}
			else {
				this.insert("<u>", "before", false); 
				this.insert("</u>", "after", true); 
			}
		});
		this.addFunction('<img src="/images/iconos/tag.png" width="16" height="16" alt="Convertir entidades &lt;, &gt; y &amp;" class="cargatipgrande" id="botoneditorentidades">', function() {
			selection = this.getSelection();
			selection = selection.replace(/&/g, "&amp;")
			selection = selection.replace(/</g, "&lt;");
			selection = selection.replace(/>/g, "&gt;")
			this.replaceSelection(selection);
		});
		this.addFunction('<img src="/images/iconos/script.png" width="16" height="16" alt="C&oacute;digo" class="cargatipgrande" id="botoneditorcodigo">', function() {
			selection = this.getSelection();
			if (selection == "") {
				this.replaceSelection("<pre class=\"codigo\">\n</pre>");
			}
			else {
				this.insert("<pre class=\"codigo\">\n", "before", false); 
				this.insert("\n</pre>", "after", true); 
			}
		});
		$("botoneditornegrita").store("tip:title", "Negrita");
		$("botoneditornegrita").store("tip:text",  "Escribir en negrita");
		$("botoneditoritalica").store("tip:title", "Itálica");
		$("botoneditoritalica").store("tip:text",  "Escribir en cursiva");
		$("botoneditorsubrayado").store("tip:title", "Subrayado");
		$("botoneditorsubrayado").store("tip:text",  "Escribir con texto subrayado");
		$("botoneditorentidades").store("tip:title", "Convertir entidades");
		$("botoneditorentidades").store("tip:text",  "Convertir a caracteres especiales las entidades &lt;, &gt; y &amp;");
		$("botoneditorcodigo").store("tip:title", "Código");
		$("botoneditorcodigo").store("tip:text",  "Escribir un pedazo de código");
		var tipsGrande3 = new Tips('.cargatipgrande', {"showDelay": 300, "hideDelay": 150, "offsets": {'x': 15, 'y': 10}, "className": "tipgrande"});
	}
});



