var winArea;
var htmlMode;
var ObjectInserted = false;
var P = "";
P += "<nobr>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"Bold\")' title=\"Negrita\"><img src='img/bold.gif' width=16 height=16 border=0></button>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"Italic\");' title=\"Cursiva\"><img src='img/italic.gif' width=16 height=16 border=0></button>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"Underline\");' title=\"Subrayada\"><img src='img/underline.gif' width=16 height=16 border=0></button>\n";
//P += "<wbr><img src='#' width=1 height=1><wbr>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"JustifyLeft\");' title=\"Alinear a la izquierda\"><img src='img/left.gif' width=16 height=16 border=0></button>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"JustifyCenter\");' title=\"Centrar\"><img src='img/center.gif' width=16 height=16 border=0></button>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"JustifyRight\");' title=\"Alinear a la derecha\"><img src='img/right.gif' width=16 height=16 border=0></button>\n";
//P += "<wbr><img src='#' width=1 height=1><wbr>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"Cut\");' title=\"Cortar\"><img src='img/cut.gif' width=16 height=16 border=0></button>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"Copy\");' title=\"Copiar\"><img src='img/copy.gif' width=16 height=16 border=0></button>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"Paste\");' title=\"Pegar\"><img src='img/paste.gif' width=16 height=16 border=0></button>\n";
//P += "<wbr><img src='#' width=1 height=1><wbr>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"Undo\");' title=\"Deshacer\"><img src='img/undo.gif' width=16 height=16 border=0></button>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"Redo\");' title=\"Rehacer\"><img src='img/redo.gif' width=16 height=16 border=0></button>\n";
//P += "<wbr><img src='#' width=1 height=1><wbr>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"InsertOrderedList\");' title=\"Numeraci&oacute;n\"><img src='img/ol.gif' width=16 height=16 border=0></button>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"InsertUnorderedList\");' title=\"Vi&ntilde;etas\"><img src='img/ul.gif' width=16 height=16 border=0></button>\n";
//P += "<wbr><img src='#' width=1 height=1><wbr>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"Outdent\");' title=\"Reducir sangr&iacute;a\"><img src='img/outdent.gif' width=16 height=16 border=0></button>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"Indent\");' title=\"Aumentar sangr&iacute;a\"><img src='img/indent.gif' width=16 height=16 border=0></button>\n";
//P += "<wbr><img src='#' width=1 height=1><wbr>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"InsertHorizontalRule\");' title=\"Insertar l&iacute;nea horizontal\"><img src='img/hr.gif' width=16 height=16 border=0></button>\n";
//P += "<wbr><img src='#' width=1 height=1><wbr>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"InsertImage\");' title=\"Insertar imagen\"><img src='img/image.gif' width=16 height=16 border=0></button>\n";
//P += "<wbr><img src='#' width=1 height=1><wbr>\n";
P += "<button class=btn unselectable=on onclick='editCallCommand(\"InsertFile\");' title=\"Archivo documental\"><img src='img/file.gif' width=16 height=16 border=0></button>\n";
P += "<wbr><img src='#' width=1 height=1><wbr>\n";
P += "<button class=btn unselectable=on onclick='editCallCommand(\"CreateLink\");' title=\"Insertar enlace\"><img src='img/a.gif' width=16 height=16 border=0></button>\n";
P += "<wbr><img src='#' width=1 height=1><wbr>\n";
//P += "<button class=btn unselectable=on onclick='editCallCommand(\"RemoveFormat\");' title=\"Borrar formato\"><img src='img/new.gif' width=16 height=16 border=0></button>\n";
//P += "<wbr><img src='#' width=1 height=1>";
//P += "<button class=btn unselectable=on onclick='showHtml()' title=\"Código HTML\"><img src='img/html.gif' width=16 height=16 border=0></button>\n";
//P += "<br>";

//P += "%OBJECT%";

/*P += "<wbr><img src='#' width=1 height=1><wbr><select onchange='editCallCommand(\"FontName\",this[this.selectedIndex].text); this.selectedIndex=0;'>\n";
P += "<option selected>- Fuente -</option>\n";
P += "<option></option>\n";
P += "<option>Arial</option>\n";
P += "<option>Comic Sans MS</option>\n";
P += "<option>Courier New</option>\n";
P += "<option>Garamond</option>\n";
P += "<option>Georgia</option>\n";
P += "<option>Tahoma</option>\n";
P += "<option>Times New Roman</option>\n";
P += "<option>Trebuchet MS</option>\n";
P += "<option>Verdana</option>\n";
P += "</select>&nbsp;<wbr><select onchange='editCallCommand(\"FontSize\", this[this.selectedIndex].text);this.selectedIndex=0;'>\n";
P += "<option>- Tama&ntilde;o -</option>\n";
P += "<option></option>\n";
P += "<option>1</option>\n";
P += "<option>2</option>\n";
P += "<option>3</option>\n";
P += "<option>4</option>\n";
P += "<option>5</option>\n";
P += "</select>";*/
/*P += "&nbsp;<wbr><select unselectable=on onchange='editCallCommand(\"ForeColor\", this[this.selectedIndex].text); this.selectedIndex=0;'>\n";
P += "<option selected>- Color -</option>\n";
P += "<option style='background-color: #000000'>#000000</option>\n";
P += "<option style='background-color: #000066'>#000066</option>\n";
P += "<option style='background-color: #006600'>#006600</option>\n";
P += "<option style='background-color: #660000'>#660000</option>\n";
P += "<option style='background-color: #006666'>#006666</option>\n";
P += "<option style='background-color: #666600'>#666600</option>\n";
P += "<option style='background-color: #660066'>#660066</option>\n";
P += "<option style='background-color: #666666'>#666666</option>\n";
P += "<option></option>\n";
P += "<option style='background-color: #000088'>#000088</option>\n";
P += "<option style='background-color: #008800'>#008800</option>\n";
P += "<option style='background-color: #880000'>#880000</option>\n";
P += "<option style='background-color: #008888'>#008888</option>\n";
P += "<option style='background-color: #888800'>#888800</option>\n";
P += "<option style='background-color: #880088'>#880088</option>\n";
P += "<option style='background-color: #888888'>#888888</option>\n";
P += "<option></option>\n";
P += "<option style='background-color: #0000aa'>#0000aa</option>\n";
P += "<option style='background-color: #00aa00'>#00aa00</option>\n";
P += "<option style='background-color: #aa0000'>#aa0000</option>\n";
P += "<option style='background-color: #00aaaa'>#00aaaa</option>\n";
P += "<option style='background-color: #aaaa00'>#aaaa00</option>\n";
P += "<option style='background-color: #aa00aa'>#aa00aa</option>\n";
P += "<option style='background-color: #aaaaaa'>#aaaaaa</option>\n";
P += "<option></option>\n";
P += "<option style='background-color: #0000ff'>#0000ff</option>\n";
P += "<option style='background-color: #00ff00'>#00ff00</option>\n";
P += "<option style='background-color: #ff0000'>#ff0000</option>\n";
P += "<option style='background-color: #00ffff'>#00ffff</option>\n";
P += "<option style='background-color: #ffff00'>#ffff00</option>\n";
P += "<option style='background-color: #ff00ff'>#ff00ff</option>\n";
P += "<option style='background-color: #ffffff'>#ffffff</option>\n";
P += "</select>\n";
P += "</nobr>\n";*/


//*****************************************************************************
function str_replace(a, b, s) {
	if(6 > parseInt(navigator.appVersion.substr(navigator.appVersion.indexOf("MSIE")+5, navigator.appVersion.length)))
		return str_replace_slow(a, b, s);
	if(!b || b == null || !b.length) return s;
	r = eval('new RegExp(/'+(""+a)+'/gi);');
	return(s.replace(r, ""+b));
}
function str_replace_slow(a, b, s) {
//	window.status = "ATENCIÓN! Usando algoritmo lento";
	if(!b || b == null || !b.length) return s;
	for(idx = 0; idx < s.length - a.length; idx++)
		if(s.substring(idx, idx+a.length) == a) {
			s = s.substring(0, idx) + b + s.substring(idx + a.length, s.length);
			idx += b.length;
	
