/*
	License Agreement
	
	Refer to your email receipt as to whether you have a Single Domain License or a 
	Multiple Domain License.

	Evaluation Version
	
	If you have not yet purchased HTML Rich Text Area then you are running the 
	Evaluation version.	The evaluation version may be installed on a development 
	server and used for a period of 30 days. Thereafter it must be uninstalled 
	or purchased. It may not be installed on any production servers.
	You cannot make any modifications to the source code of HTML Rich Text Area.
	
	
	Single Domain License

	If you have purchased the Single Domain License you are licensed to run the HTML 
	Rich Text Area on one production domain.  
	A domain is defined as a web site associated with a particular Internet Domain Name
	or an Intranet site. One license grants you the use of HTML Rich Text Area on an 
	unlimited number of web pages belonging to that domain or Intranet site.  The 
	license is not limited by the number of users, hits on the web site, servers 
	in a web farm or the number of CPUs in the web server. HTML Rich Text Area may also
	be used on internal development workstations or development servers.
	Additional licenses can be purchased for additional domains.
	
	You are licensed to modify the source code of HTML Rich Text Area.
	

	Multiple Domain License

	If you have purchased the Multiple Domain License you are licensed to run the HTML 
	Rich Text Area on more than one production domain managed by your company.
	A domain is defined as a web site associated with a particular Internet Domain Name
	or an Intranet site. This license grants you the use of HTML Rich Text Area on an 
	unlimited number of web pages belonging to multiple domains or Intranet sites
	managed by your company.  The license is not limited by the number of users, 
	hits on the web site, servers in a web farm or the number of CPUs in the web server. 
	HTML Rich Text Area may also be used on internal development workstations or development 
	servers.
	
	You are licensed to modify the source code of HTML Rich Text Area.


	Product Integration License
		
	If you have purchased the Product Integration License you are licensed to incorporate 
	the HTML Rich Text Area into an application that may be sold or distributed.  
	An application is defined as a single software package designed perform a particular 
	task including its various versions. This license grants you the use of the HTML  
	Rich Text Area in an unlimited number of distributions of the application. Any source 
	code modifications to the HTML Rich Text Area must be agreed to by 
	tcpIQ/Sigma Solutions.  Your application's licensing agreement must indicate that 
	the end users may not change the HTML Rich Text Area software, distribute it 
	or reverse engineer it.  The wording of the licensing agreement must be agreed to 
	by tcpIQ/Sigma Solutions. Only the obfuscated version of the HTML Rich Text Area
	can be distributed within the application.
		
		

	Distribution of this software

	Other than the serving of web pages that contain the HTML Rich Text Area, 
	you are not allowed to redistribute this software or any modifications that 
	are made to the source code. You are specifically prohibited from charging, 
	or requesting donations, for any such copies, however made; and from
	distributing the software and/or documentation with other products
	(commercial or otherwise) without prior written permission.
	The transfer of this license to other parties is not allowed.


	Disclaimer of Warranty

	This software and the accompanying files are sold "as is" and 
	without warranties as to performance or merchantability or any other 
	warranties whether expressed or implied. Because of the various 
	hardware and software environments into which HTML Rich Text Area
	may be put, no warranty of fitness for a particular purpose is 
	offered.

	The user must assume the entire risk of using the program. 
	Any liability of the seller will be limited exclusively to product 
	replacement or refund of purchase price.

	(c) Copyright 2003 tcpIQ (Sigma Solutions)
	
*/
  var DISABLEDOPACITY = 25;
  var BTN_TYPE_STANDARD = 0;
  var BTN_TYPE_PRESENTATION = 1;
  var BTN_TYPE_SRC = 2;
  var BTN_TYPE_TABLE = 3;
  var BTN_TYPE_INPUT = 4; 
  var BTN_TYPE_DROPDOWN = 5;
  var BTN_TYPE_SPACER = 6; 
  var BTN_TYPE_SPECIAL = 7;
  var BTN_PROP_IMGURL = 0; 
  var BTN_PROP_TITLE = 1; 
  var BTN_PROP_FUNC = 2; 
  var BTN_PROP_TYPE = 3; 
  var BTN_PROP_DEFSTATUS = 4;
  var BTN_PROP_WIDTH = 5;
  var BTN_PROP_CMDID = 6; 
  var intEditorCount = 0;  
  var guidelinesOn = false; 
  function HTMLRichTextArea(strFormElName, strW, strH, strDefaultHTML,myRecordId)
  {  
  	try
	{
		IMG_DIRECTORY = IMG_DIRECTORY;  
	} 
	catch(e)
	{
		alert('PROGRAMMING ERROR: You have not included a reference to the HTMLRichTextAreaFactorySettings.js file (or similiar).  The HTML Rich Text Area will not be displayed until you do.');
		return; 
	} 
	intEditorCount += 1; 
	this.ImgDir = IMG_DIRECTORY; 
	this.stylesheet = CSS_FILE; 
	this.OldText = strDefaultHTML;
	this.iframeId = ("HTMLRichTextArea"+intEditorCount+strFormElName+"_"+myRecordId).replace(' ', '');
	this.height = strH; 
	this.width = strW; 
	this.defaultHTML = strDefaultHTML; 
	this.FormElementName = strFormElName; 
	this.ToolbarBtns = this.CreateToolbarButtonArray();
  }  

HTMLRichTextArea.prototype.Draw = function()
{
	try
	{
		IMG_DIRECTORY = IMG_DIRECTORY; 
	}  
	catch(e)  {  return;  }
	if ((navigator.appName.indexOf("Microsoft Internet Explorer") >= 0) && (navigator.appVersion.indexOf("MSIE 4") == -1) && (navigator.appVersion.indexOf("MSIE 3") == -1))
	{  
		if (SHOWHTMLRTABORDER == true)
		{  
			if (SIZESINPERCENT == false) 
			{
				document.write("<table cellpadding='" + HTMLRTABORDERSIZE + "' bgcolor='" + HTMLRTABORDERCOLOR + "' width='"+this.width+"' style='" + HTMLRTABORDERSTYLE + "'><tr><td>");
			}
			else 
			{  
				document.write("<table cellpadding='" + HTMLRTABORDERSIZE + "' bgcolor='" + HTMLRTABORDERCOLOR + "' width='"+this.width+"%' style='" + HTMLRTABORDERSTYLE + "'><tr><td>");
			}
		}  
		document.write("<style TYPE='text/css'>\n");
		document.write(".BUTTONLATCHED {\n");
		document.write("background-color: #c1d2ee;\n");
		document.write("border-right: #316ac5 1px solid;\n");
		document.write("border-top: #316ac5 1px solid;\n");
		document.write("border-left: #316ac5 1px solid;\n"); 
		document.write("border-bottom: #316ac5 1px solid;\n");
		if (SHOWCURSORASHAND == true)document.write("cursor:hand;\n");
		document.write("disabled:false;\n"); 
		document.write("}\n"); 
		document.write(".BUTTONENABLED {\n");
		document.write("border-right: #efefde 1px solid;\n");
		document.write("border-top: #efefde 1px solid;\n");
		document.write("border-left: #efefde 1px solid;\n");
		document.write("border-bottom: #efefde 1px solid;\n");
		if (SHOWCURSORASHAND == true)document.write("cursor:hand;\n");
		document.write("disabled:false;\n");
		document.write("}\n"); 
		document.write(".BUTTONDISABLED {\n"); 
		document.write("border-right: #efefde 1px solid;\n");
		document.write("border-top: #efefde 1px solid;\n"); 
		document.write("border-left: #efefde 1px solid;\n");
		document.write("border-bottom: #efefde 1px solid;\n");
		document.write("cursor:default;\n");
		document.write("disabled:true;\n");  
		document.write("filter:alpha(opacity=" + DISABLEDOPACITY + ");\n"); 
		document.write("}\n"); 
		document.write(".SUNKEN {\n");
		document.write("border-top: #a0a0a0 1px solid;\n"); 
		document.write("border-left: #a0a0a0 1px solid;\n"); 
		document.write("border-bottom: #f0f0f0 1px solid;\n");
		document.write("border-right: #f0f0f0 1px solid;\n"); 
		document.write("cursor:default;\n"); 
		document.write("font-size:xx-small;\n");
		document.write("}\n"); 
		document.write("</style>\n");
		if (SHOWHTMLRTABORDER == false)
		{
			if (SIZESINPERCENT == false) 
			{  
				document.write("<TABLE cellspacing=0 border=0 cellpadding=1 ondragstart='return false;' width='"+this.width+"'><TR><TD bgcolor='" + HTMLRTABORDERCOLOR + "'>");
			}
			else 
			{  
				document.write("<TABLE cellspacing=0 border=0 cellpadding=1 ondragstart='return false;' width='"+this.width+"%'><TR><TD bgcolor='" + HTMLRTABORDERCOLOR + "'>");
			}
		} 
		else 
		{  
			document.write("<TABLE cellspacing=0 border=0 cellpadding=1 width='100%' ondragstart='return false;'><TR><TD bgcolor='" + HTMLRTABORDERCOLOR + "'>");
		} 
		this.DrawToolBar(); 
		var strDefault; 
		strDefault = this.defaultHTML.replace(/\"/gi, "\\\""); 
		strDefault = strDefault.replace(/\n/gi, "\\n");
		if (SHOWHTMLRTABORDER == false)
		{ 
			if (SIZESINPERCENT == false) 
			{ 
				document.write("<iframe ID='RO"+this.iframeId+"' style='display:none;width:"+(this.width)+"px;height:"+(this.height)+"px;'></iframe>");
			}  
			else 
			{  
				document.write("<iframe ID='RO"+this.iframeId+"' style='display:none;width:100%;height:"+(this.height)+"px;'></iframe>");
			}  
		}  
		else 
		{
			document.write("<iframe ID='RO"+this.iframeId+"' style='display:none;width:100%;height:"+(this.height)+"px;'></iframe>");
		}  
		if (SHOWHTMLRTABORDER == false)
		{
			if (SIZESINPERCENT == false)
			{
				document.write("<TEXTAREA Name='"+this.FormElementName+"' ID='TXT"+this.iframeId+"' style='display:none;width:"+(this.width)+"px;height:"+(this.height)+"px;'></TEXTAREA>");
			}
			else
			{
				document.write("<TEXTAREA Name='"+this.FormElementName+"' ID='TXT"+this.iframeId+"' style='display:none;width:100%;height:"+(this.height)+"px;'></TEXTAREA>");
			}
		}
		else
		{
			document.write("<TEXTAREA Name='"+this.FormElementName+"' ID='TXT"+this.iframeId+"' style='display:none;height:"+(this.height)+"px;'></TEXTAREA>");
		}
		document.write(""+  "<scr" + "ipt LANGUAGE=\"javascript\" FOR=\""+this.iframeId+"\" EVENT=\"onload\">"+  "<!--\n"+  "return EditorLoaded(\""+this.iframeId+"\",\""+strDefault+"\")\n"+  "/" + "/-->\n"+  "</script>");
		if (SHOWHTMLRTABORDER == false)
		{
			if (SIZESINPERCENT == false)
			{
				document.write("<iframe ID='"+this.iframeId+"' STYLE='background-color:white; height:"+this.height+";width:"+ (this.width + 5)+"'></iframe>");
			}
			else
			{
				document.write("<iframe ID='"+this.iframeId+"' height="+this.height+" width='100%' bgcolor='white'></iframe>");
			}
		}
		else
		{
			document.write("<iframe ID='"+this.iframeId+"' height="+this.height+" width='100%' bgcolor='white'></iframe>");
		}
		DrawStatusBar(this.iframeId);
		document.write("</TD></TR></TABLE>");
		if (SHOWHTMLRTABORDER == true)
		{
			document.write("</td></tr></table>");
		}
		var DHTMLCtrl = eval("document.all."+this.iframeId);
		DHTMLCtrl.toolbarArray = this.ToolbarBtns;
	}
	else 
	{
		if (SIZESINPERCENT == false)
		{
			document.write("<TEXTAREA Name='"+this.FormElementName+"' ID='TXT"+this.iframeId+"' style='width:"+(this.width)+"px;height:"+(this.height)+"px;'></TEXTAREA>");
		}
		else 
		{
			document.write("<TEXTAREA Name='"+this.FormElementName+"' ID='TXT"+this.iframeId+"' style='width:100%;height:"+(this.height)+"px;'></TEXTAREA>");
		}
	}
}  

HTMLRichTextArea.prototype.GetHTML = function(){  EditorDisplayChanged(this.iframeId);  ctrlText = eval("document.all.TXT"+this.iframeId);  return(ctrlText.value);  }  
HTMLRichTextArea.prototype.SetHTML = function(strHTML){  var editorObject = GetEditorRef(this.iframeId);  editorObject.body.innerHTML = strHTML;  EditorDisplayChanged(this.iframeId);  }  
HTMLRichTextArea.prototype.InsertHTML = function(strHTML){  var editorObject = GetEditorRef(this.iframeId);  PutHTML(this.iframeId, strHTML);  }  
HTMLRichTextArea.prototype.MakeReadOnly = function(blnReadOnly){  var editorObject = GetEditorRef(this.iframeId);  ctrlHTML = eval("document.all."+this.iframeId);  ctrlReadOnly = eval("document.all.RO"+this.iframeId);  ctrlToolBar = eval("document.all.TB"+this.iframeId);  ctrlStatusBar = eval("document.all.SB"+this.iframeId);  if (blnReadOnly == true)  {  ctrlReadOnly.contentWindow.document.body.innerHTML = editorObject.body.innerHTML;  ctrlHTML.style.display = 'none';  ctrlToolBar.style.display = 'none';  ctrlStatusBar.style.display = 'none';  ctrlReadOnly.style.display = 'inline';  }  else {  ctrlHTML.style.display = 'inline';  ctrlToolBar.style.display = 'inline';  ctrlStatusBar.style.display = 'inline';  ctrlReadOnly.style.display = 'none';  }  }  

HTMLRichTextArea.prototype.CreateToolbarButtonArray = function()
{
	TbarBtns = new Array();
	if (SHOWPRINTER == true)
	{  
		pushItem(TbarBtns, new Array("print.gif", "Imprimir", "document.all('" + this.iframeId + "').contentWindow.document.execCommand('Print');",BTN_TYPE_STANDARD,true,"25","Print"));
	}  
	if (SHOWFINDBUTTON == true)  
	{ 
		pushItem(TbarBtns, new Array("find.gif", "Buscar y Reemplazar", "FindAndReplace('"+this.iframeId+"');", BTN_TYPE_SPECIAL,true,"25","FindAndReplace")); 
	}  
	if (SHOWSPELLCHECKBUTTON == true)  
	{  
		pushItem(TbarBtns, new Array("SpellCheck.gif", "Check Spelling","window.showModalDialog(WBSC_FILE,document.all."+this.iframeId+".contentWindow.document.body,'dialogHeight: 300px; dialogWidth: 285px; center: Yes; help: No; resizable: No; status: No;');",BTN_TYPE_SPECIAL,true,"25","SpellCheck"));  
		pushItem(TbarBtns, new Array("spacer.gif", "", "", BTN_TYPE_SPACER,true,"2","Spacer1"));  
	}  
	if (SHOWADDIMAGEBUTTON == true)  
	{  
		pushItem(TbarBtns, new Array("image.gif", "Insertar imágen desde hipervínculo", "alert('ATENCIÓN : Si se inserta una imagen local desde su disco duro, ésta no se mostrará. Introduzca sólamente URLs');"+"document.all('" + this.iframeId + "').contentWindow.document.execCommand('InsertImage', true);", BTN_TYPE_STANDARD,true,"25","InsertImage"));  
	}  
	if (SHOWADDFROMLIBRARY == true)  
	{  
		pushItem(TbarBtns, new Array("library.gif", "Insertar imágen desde Galería", "AddFromLibrary('"+this.iframeId+"');", BTN_TYPE_SPECIAL,true,"25","LoadFromLibrary"));  
	}  
	if (SHOWHYPERLINKBUTTON == true)  
	{  
		pushItem(TbarBtns, new Array("link.gif", "Insertar Enlace", "document.all('" + this.iframeId + "').contentWindow.document.execCommand('CreateLink'); UndoCheckPoint('" + this.iframeId + "', true);", BTN_TYPE_STANDARD,true,"25","CreateLink")); 
		pushItem(TbarBtns, new Array("spacer.gif", "", "", BTN_TYPE_SPACER,true,"2","Spacer2")); 
	}
	if (SHOWUNDOREDO == true)  
	{  
		pushItem(TbarBtns, new Array("undo.gif", "Deshacer", "UndoManager('" + this.iframeId + "');",BTN_TYPE_SPECIAL,true,"25","Undo"));
		pushItem(TbarBtns, new Array("redo.gif", "Rehacer", "RedoManager('" + this.iframeId + "');",BTN_TYPE_SPECIAL,true,"25","Redo"));
	}  
	if (SHOWCUTCOPYPASTE == true)  
	{  
		pushItem(TbarBtns, new Array("cut.gif", "Cortar", "document.all('" + this.iframeId + "').contentWindow.document.execCommand('Cut'); UndoCheckPoint('" + this.iframeId + "', true);", BTN_TYPE_STANDARD,true,"25","Cut"));
		pushItem(TbarBtns, new Array("copy.gif", "Copiar", "document.all('" + this.iframeId + "').contentWindow.document.execCommand('Copy');", BTN_TYPE_STANDARD,true,"25","Copy")); 
		pushItem(TbarBtns, new Array("paste.gif", "Pegar", "ExecuteAPaste('" + this.iframeId + "');  UndoCheckPoint('" + this.iframeId + "', true);", BTN_TYPE_STANDARD,true,"25","Paste"));  
		pushItem(TbarBtns, new Array("spacer.gif", "", "", BTN_TYPE_SPACER,true,"2","Spacer3"));
	} 
	if (SHOWPRESENTATIONBUTTONS == true)
	{ 
		pushItem(TbarBtns, new Array("bold.gif","Negrita","ActivateEditor('" + this.iframeId + "'); document.all('" + this.iframeId + "').contentWindow.document.execCommand('Bold'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","Bold"));
		pushItem(TbarBtns, new Array("italic.gif","Itálica","ActivateEditor('" + this.iframeId + "'); document.all('" + this.iframeId + "').contentWindow.document.execCommand('Italic'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","Italic")); 
		pushItem(TbarBtns, new Array("under.gif","Subrayado","ActivateEditor('" + this.iframeId + "'); document.all('" + this.iframeId + "').contentWindow.document.execCommand('Underline'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","Underline"));
		pushItem(TbarBtns, new Array("strikethrough.gif","Tachado","ActivateEditor('" + this.iframeId + "'); document.all('" + this.iframeId + "').contentWindow.document.execCommand('Strikethrough'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","Strikethrough"));
	}
	if (SHOWSUPERSUBSCRIPT == true)
	{  
		pushItem(TbarBtns, new Array("superscript.gif","Superíndice","ActivateEditor('" + this.iframeId + "'); document.all('" + this.iframeId + "').contentWindow.document.execCommand('Superscript'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","Superscript"));
		pushItem(TbarBtns, new Array("subscript.gif","Subíndice","ActivateEditor('" + this.iframeId + "'); document.all('" + this.iframeId + "').contentWindow.document.execCommand('Subscript'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","Subscript")); 
		pushItem(TbarBtns, new Array("spacer.gif", "", "", BTN_TYPE_SPACER,true,"2","Spacer4"));
	}
	if (SHOWADDITIONALPRESENTATIONBUTTONS == true)
	{
		pushItem(TbarBtns, new Array("clearformatting.gif","Borrar Formato","ClearFormatting('" + this.iframeId + "'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_STANDARD,true,"25","RemoveFormat"));
		pushItem(TbarBtns, new Array("spacer.gif", "", "", BTN_TYPE_SPACER,true,"2","Spacer20"));
		pushItem(TbarBtns, new Array("inindent.gif","Aumentar Sangría","ActivateEditor('" + this.iframeId + "'); document.all('" + this.iframeId + "').contentWindow.document.execCommand('Indent'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","Indent"));
		pushItem(TbarBtns, new Array("deindent.gif","Disminuir Sangría","ActivateEditor('" + this.iframeId + "'); document.all('" + this.iframeId + "').contentWindow.document.execCommand('Outdent'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","Outdent")); 
		pushItem(TbarBtns, new Array("left.gif","Alineación Izquierda","ActivateEditor('" + this.iframeId + "'); document.all('" + this.iframeId + "').contentWindow.document.execCommand('JustifyLeft'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","JustifyLeft"));
		pushItem(TbarBtns, new Array("center.gif","Alineación Centro","ActivateEditor('" + this.iframeId + "'); document.all('" + this.iframeId + "').contentWindow.document.execCommand('JustifyCenter'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","JustifyCenter"));
		pushItem(TbarBtns, new Array("right.gif","Alineación Derecha","ActivateEditor('" + this.iframeId + "'); document.all('" + this.iframeId + "').contentWindow.document.execCommand('JustifyRight'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","JustifyRight")); 
		pushItem(TbarBtns, new Array("spacer.gif", "", "", BTN_TYPE_SPACER,true,"2","Spacer21"));
	}
	if (SHOWLIST == true)  
	{
		pushItem(TbarBtns, new Array("numlist.gif","Lista numerada","ActivateEditor('" + this.iframeId + "'); SetNumberedList('" + this.iframeId + "'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","InsertOrderedList")); 
		pushItem(TbarBtns, new Array("bullist.gif","Lista con viñetas","ActivateEditor('" + this.iframeId + "'); SetUnOrderedList('" + this.iframeId + "'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","InsertUnorderedList")); 
		pushItem(TbarBtns, new Array("spacer.gif", "", "", BTN_TYPE_SPACER,true,"2","Spacer5"));
	}
	if (SHOWHORIZONTALRULE == true)
	{
		pushItem(TbarBtns, new Array("horizontalrule.gif","Insertar línea horizontal","ActivateEditor('" + this.iframeId + "'); document.all('" + this.iframeId + "').contentWindow.document.execCommand('InsertHorizontalRule'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_PRESENTATION,true,"25","InsertHorizontalRule"));
	}  
	if (SHOWSPECIALCHARACTERS == true)  
	{  
		pushItem(TbarBtns, new Array("symbol.gif","Insertar simbolo","ActivateEditor('" + this.iframeId + "'); InsertSymbol('" + this.iframeId + "'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_SPECIAL,true,"25","InsertSymbol")); 
		pushItem(TbarBtns, new Array("emoticon.gif","Insertar emoticon","ActivateEditor('" + this.iframeId + "'); InsertEmoticon('" + this.iframeId + "'); UndoCheckPoint('" + this.iframeId + "', true);",BTN_TYPE_SPECIAL,true,"25","InsertEmoticon"));
	}
	if (SHOWABSOLUTEPOSITIONING == true)
	{
		pushItem(TbarBtns, new Array("abspos.gif","Posicionamiento Absoluto","ActivateEditor('" + this.iframeId + "'); document.all('" + this.iframeId + "').contentWindow.document.execCommand('AbsolutePosition');",BTN_TYPE_PRESENTATION,true,"25","AbsolutePosition"));
	}
	if (SHOWHEADINGDROPDOWN == true)
	{
		pushItem(TbarBtns, new Array(this.StyleDropDown(),"Font Name","",BTN_TYPE_DROPDOWN,true,"100","ParagraphType"));
	}
	if (SHOWFONTSTYLEMODIFICATION == true)
	{
		pushItem(TbarBtns, new Array(this.FontFamilyDropDowns(),"Style","",BTN_TYPE_DROPDOWN,true,"100","FontFamily"));
		pushItem(TbarBtns, new Array(this.FontSizeDropDowns(),"Font Size","",BTN_TYPE_DROPDOWN,true,"50","FontSize"));
		pushItem(TbarBtns, new Array("spacer.gif", "", "", BTN_TYPE_SPACER,true,"2","Spacer6"));
	}  

	if (true) 
	{
		pushItem(TbarBtns, new Array("instable.gif", "Insertar Tabla","DisplayTableWindow('"+this.iframeId+"');",BTN_TYPE_STANDARD,true,"25","InsertTable")); 
		pushItem(TbarBtns, new Array("insrow.gif", "Insertar Fila","InsertRow('"+this.iframeId+"');",BTN_TYPE_STANDARD,true,"25","InsertRow"));
		pushItem(TbarBtns, new Array("inscol.gif", "Insertar Columna","InsertColumn('"+this.iframeId+"');",BTN_TYPE_STANDARD,true,"25","InsertColumn"));
		pushItem(TbarBtns, new Array("inscell.gif", "Insertar Celda","InsertCell('"+this.iframeId+"');",BTN_TYPE_STANDARD,true,"25","InsertCell")); 
		pushItem(TbarBtns, new Array("delcell.gif","Borrar Celda","DeleteCell('"+this.iframeId+"');",BTN_TYPE_STANDARD,true,"25","DeleteCell")); 
		pushItem(TbarBtns, new Array("delcol.gif", "Borrar Columna","DeleteColumn('"+this.iframeId+"');",BTN_TYPE_STANDARD,true,"25","DeleteColumn")); 
		pushItem(TbarBtns, new Array("delrow.gif", "Borrar Fila","DeleteRow('"+this.iframeId+"');",BTN_TYPE_STANDARD,true,"25","DeleteRow")); 
		pushItem(TbarBtns, new Array("borders.gif", "Bordes","ToggleGuideLines('"+this.iframeId+"');",BTN_TYPE_STANDARD,true,"25","Borders"));
		pushItem(TbarBtns, new Array("spacer.gif", "", "", BTN_TYPE_SPACER,true,"2","Spacer7"));
	} 	

	if (SHOWCOLORSELECTION == true)
	{  
		pushItem(TbarBtns, new Array("fgcolor.gif","Color de Primer Plano","DisplayColorWindow('FG','"+this.iframeId+"')",BTN_TYPE_STANDARD,true,"25","ForeColor")); 
		pushItem(TbarBtns, new Array("bgcolor.gif","Color de Fondo","DisplayColorWindow('BG','"+this.iframeId+"')",BTN_TYPE_STANDARD,true,"25","BackColor")); 
		pushItem(TbarBtns, new Array("spacer.gif", "", "", BTN_TYPE_SPACER,true,"2","Spacer8")); 
	}  
	if (SHOWDATETIME == true) 
	{  
		pushItem(TbarBtns, new Array("date.gif","Insertar Fecha","InsertDate('"+this.iframeId+"')",BTN_TYPE_SPECIAL,true,"25","InsertDate"));
		pushItem(TbarBtns, new Array("time.gif","Insertar Hora","InsertTime('"+this.iframeId+"')",BTN_TYPE_SPECIAL,true,"25","InsertTime")); 
		pushItem(TbarBtns, new Array("spacer.gif", "", "", BTN_TYPE_SPACER,true,"2","Spacer9"));
	} 
	if (SHOWSOURCEBUTTON == true)
	{  
		pushItem(TbarBtns, new Array("source.gif", "Ver código fuente HTML del texto","ToggleSourceView('"+this.iframeId+"');",BTN_TYPE_SRC,true,"25","ToggleSource")); 
		pushItem(TbarBtns, new Array("spacer.gif", "", "", BTN_TYPE_SPACER,true,"2","Spacer10")); 
	} 
	if (SHOWCUSTOMBUTTON1 == true) 
	{ 
		pushItem(TbarBtns, new Array(CUSTOMBUTTON1IMAGE, CUSTOMBUTTON1CALLBACKTOOLTIP, CUSTOMBUTTON1CALLBACK + "('"+this.iframeId+"');",BTN_TYPE_SPECIAL,true,"25","CustomButton1"));
	}  
	if (SHOWCUSTOMBUTTON2 == true) 
	{  
		pushItem(TbarBtns, new Array(CUSTOMBUTTON2IMAGE, CUSTOMBUTTON2CALLBACKTOOLTIP, CUSTOMBUTTON2CALLBACK + "('"+this.iframeId+"');",BTN_TYPE_SPECIAL,true,"25","CustomButton2"));
	} 
	if (SHOWCUSTOMBUTTON3 == true)  
	{  
		pushItem(TbarBtns, new Array(CUSTOMBUTTON3IMAGE, CUSTOMBUTTON3CALLBACKTOOLTIP, CUSTOMBUTTON3CALLBACK + "('"+this.iframeId+"');",BTN_TYPE_SPECIAL,true,"25","CustomButton3")); 
	}  
	return TbarBtns; 
}  

HTMLRichTextArea.prototype.StyleDropDown = function()
{
	var sDropDown = "<SELECT ID=\""+this.iframeId+"_ParagraphStyle\" unselectable='on' style='width:100px;font-size:xx-small' onchange=\"return ParagraphStyle('"+this.iframeId+"')\">"  + "<option value=\"Normal\">Normal</option>"  + "<option value=\"Heading 1\">Heading 1</option>"  + "<option value=\"Heading 2\">Heading 2</option>"  + "<option value=\"Heading 3\">Heading 3</option>"  + "<option value=\"Heading 4\">Heading 4</option>"  + "<option value=\"Heading 5\">Heading 5</option>"  + "<option value=\"Heading 6\">Heading 6</option>"  + "<option value=\"Address\">Address</option>"  + "<option value=\"Formatted\">Formatted</option>"     + "</SELECT>";
	return sDropDown;
}  

HTMLRichTextArea.prototype.FontSizeDropDowns = function(){  if (SHOWFONTSIZESINPOINTS == false)  {  var sDropDown = "<select ID='"+this.iframeId+"_FontSize' unselectable='on' style='width:50px;font-size:xx-small' onchange=\"return FontSize('"+this.iframeId+"')\">"  + "  <option value='1'>1</option>"  + "  <option value='2'>2</option>"  + "  <option value='3'>3</option>"  + "  <option value='4'>4</option>"  + "  <option value='5'>5</option>"  + "  <option value='6'>6</option>"  + "  <option value='7'>7</option>"  + "</select>";  return sDropDown;  }  else {  var sDropDown = "<select ID='"+this.iframeId+"_FontSize' unselectable='on' style='width:50px;font-size:xx-small' onchange=\"return FontSize('"+this.iframeId+"')\">"  + "  <option value='1'>8 pt</option>"  + "  <option value='2'>10 pt</option>"  + "  <option value='3'>12 pt</option>"  + "  <option value='4'>14 pt</option>"  + "  <option value='5'>18 pt</option>"  + "  <option value='6'>24 pt</option>"  + "  <option value='7'>36 pt</option>"  + "</select>";  return sDropDown;  }  }  

HTMLRichTextArea.prototype.FontFamilyDropDowns = function(){  var sDropDown = "<select ID='"+this.iframeId+"_FontName' unselectable='on' style='width:120px;font-size:xx-small' onchange=\"return FontName('"+this.iframeId+"')\">";  for (index = 0; index < FONTLIST.length; index++)  {  sDropDown += "<option value='" + FONTLIST[index] + "'>" + FONTLIST[index] + "</option>";  }  sDropDown += "</select>";  return sDropDown;  }  

HTMLRichTextArea.prototype.DrawToolBar = function()
{
	var intButtonWidth = this.width;
	strTBar = "<DIV ID='TB"+this.iframeId+"'>";
	strTBar += "<TABLE ID='TBTABLE"+this.iframeId+"' ondragstart=\"return false;\" WIDTH='"+this.width+"' onselectstart=\"return false\" CELLPADDING=0 CELLSPACING=0 BORDER=0>";
	strTBar += "<TR><TD>";
	var intBtnCount = 0; 
	 if (SHOWBOGUSTOOLBARHANDLES == true)
	{  
		strTBar += "<img align='absbottom' SRC='" + this.ImgDir + "doublespacer.gif' unselectable='on'>";
		intBtnCount += 7;
	}
	for (i=0;i<this.ToolbarBtns.length;i++)
	{
		var blIncludeBtn = true;
		switch (this.ToolbarBtns[i][BTN_PROP_TYPE])
		{
			case BTN_TYPE_SRC:
				if(!SHOWSOURCEBUTTON)
				{
					blIncludeBtn = false;
				}
				break;
			case BTN_TYPE_TABLE:
				if(!false)
				{
					blIncludeBtn = false;
				}
				break;
			case BTN_TYPE_SPACER:
				if(!SHOWTOOLBARSPACERS)
				{
					blIncludeBtn = false;
				}
				break;
			default:
				break;
		}
		if(this.ToolbarBtns[i][BTN_PROP_TYPE] == BTN_TYPE_INPUT && CHARACTERLIMIT == "")
		{
			blIncludeBtn = false;
		}
		if (blIncludeBtn)
		{
			intBtnCount += parseInt(this.ToolbarBtns[i][BTN_PROP_WIDTH]);  strTBar += "";
			if (SIZESINPERCENT == false)
			{
				if (intBtnCount > intButtonWidth)
				{
					strTBar += "</TD></TR><TR><TD>";
					intBtnCount = 0;
					if (SHOWBOGUSTOOLBARHANDLES == true)
					{
						strTBar += "<img align='absbottom' SRC='" + this.ImgDir + "doublespacer.gif' unselectable='on'>";  intBtnCount += 7;
					}
					intBtnCount += parseInt(this.ToolbarBtns[i][BTN_PROP_WIDTH]);
				}
			}
		else
		{
			if (intBtnCount > MINBUTTONROWWIDTH)
			{
				strTBar += "</TD></TR><TR><TD>";
				intBtnCount = 0;
				if (SHOWBOGUSTOOLBARHANDLES == true)
				{
					strTBar += "<img align='absbottom' SRC='" + this.ImgDir + "doublespacer.gif' unselectable='on'>";
					intBtnCount += 7;
				}
				intBtnCount += parseInt(this.ToolbarBtns[i][BTN_PROP_WIDTH]);
			}
		}
		if(this.ToolbarBtns[i][BTN_PROP_TYPE] == BTN_TYPE_INPUT)
		{
			strTBar += this.ToolbarBtns[i][BTN_PROP_IMGURL];
		}
		else if(this.ToolbarBtns[i][BTN_PROP_TYPE] == BTN_TYPE_DROPDOWN)
		{
			strTBar += this.ToolbarBtns[i][BTN_PROP_IMGURL];
		}
		else if(this.ToolbarBtns[i][BTN_PROP_TYPE] == BTN_TYPE_SPACER)  
		{
			if (SHOWTOOLBARSPACERS == true)
			{
				strTBar += "<IMG align=absmiddle unselectable='on' SRC='"+this.ImgDir+this.ToolbarBtns[i][BTN_PROP_IMGURL]+"'>";
			}
		}
		else 
		{
			strTBar += "<IMG align=absmiddle ";
			if(this.ToolbarBtns[i][BTN_PROP_CMDID] !== "")
			{
				strTBar += "ID='"+this.iframeId+this.ToolbarBtns[i][BTN_PROP_CMDID]+"'";
			}
			strTBar += " unselectable='on' width=23 height=22 onclick=\""+this.ToolbarBtns[i][BTN_PROP_FUNC]+"; ButtonStates('"+this.iframeId+"');\" TITLE='"+this.ToolbarBtns[i][BTN_PROP_TITLE]+"' SRC='"+this.ImgDir+this.ToolbarBtns[i][BTN_PROP_IMGURL]+"' onmouseover='this.style.backgroundColor=\"#d1e2fe\";' onmouseout='this.style.backgroundColor=\"\";' class='BUTTONENABLED'>";
		}
	}
}  strTBar += "</TD></TR>";  strTBar += "</TABLE></DIV>";  document.write(strTBar);  
}  

function EditorDisplayChanged(iframeId)
{
	var iframeObject = GetIFrameRef(iframeId);
	var editorObject = GetEditorRef(iframeId);
	ctrlText = eval("document.all.TXT"+iframeId);
	ctrlReadOnly = eval("document.all.RO"+iframeId);
	if(ctrlText.style.display == "none")  
	{
		if (EVENTCATCHER != "") 
		{
			if (ctrlText.value != editorObject.body.innerHTML)
			{
				eval(EVENTCATCHER);
			}
		}
		else 
		{
			ctrlText.value = editorObject.body.innerHTML;
		}
		ButtonStates(iframeId);
	}
}  

function ButtonStates(iframeId)
{
	var i;
	var strStatus = "";
	var iframeObject = GetIFrameRef(iframeId);
	var editorObject = GetEditorRef(iframeId);
	ctrlText = eval("document.all.TXT"+iframeId);
	ctrlOverwrite = eval("document.all.Overwrite"+iframeId); 
	ctrlInsert = eval("document.all.Insert"+iframeId);
	
	if(ctrlText.style.display != "none")
	{
		for (i=0; i < iframeObject.toolbarArray.length; i++)
		{
			try
			{
				if ((iframeObject.toolbarArray[i][BTN_PROP_TYPE] != BTN_TYPE_TABLE) && (iframeObject.toolbarArray[i][BTN_PROP_TYPE] != BTN_TYPE_SPECIAL)  && (iframeObject.toolbarArray[i][BTN_PROP_TYPE] != BTN_TYPE_SRC))
				{
					if (iframeObject.toolbarArray[i][BTN_PROP_CMDID] != "")
					{
						strCmd = iframeObject.toolbarArray[i][BTN_PROP_CMDID];
						var ImgRef = GetToolbarButtonRefFromNumber(iframeId, i);
						if (editorObject.queryCommandSupported(strCmd) == false)
						{
							ImgRef.className = "BUTTONDISABLED";
							ImgRef.disabled = true;
						}
						else
						{
							if (editorObject.queryCommandState(strCmd) == true)
							{
								ImgRef.className = "BUTTONLATCHED";
								ImgRef.disabled = false;
								if (iframeObject.toolbarArray[i][BTN_PROP_TITLE] != null)
								{
									strStatus += iframeObject.toolbarArray[i][BTN_PROP_TITLE] + ' ';
								}
							}
							else
							{
								ImgRef.className = "BUTTONENABLED";
								ImgRef.disabled = false;
							}
						}
					}
				}
			}
			catch(e)  {  }
		}
		if (SHOWHEADINGDROPDOWN == true)
		{
			var ctrlPara = eval("document.all."+iframeId+"_ParagraphStyle");
			if (editorObject.queryCommandSupported("FormatBlock") == false)
			{
				ctrlPara.disabled = true;
			}
			else
			{
				ctrlPara.disabled = false;
				ctrlPara.value = editorObject.queryCommandValue("FormatBlock");
				if (editorObject.queryCommandValue("FormatBlock").indexOf("List") == -1)
				{
					if (editorObject.queryCommandValue("FormatBlock") != null)
					{
						strStatus += editorObject.queryCommandValue("FormatBlock") + ' ';
					}
				}
			}
		}
		if (SHOWFONTSTYLEMODIFICATION == true)
		{
			var ctrlFontName = eval("document.all."+iframeId+"_FontName");
			if (editorObject.queryCommandSupported("FontName") == false)
			{
				ctrlFontName.disabled = true;
			}
			else
			{
				ctrlFontName.disabled = false;
				ctrlFontName.value = editorObject.queryCommandValue("FontName");
				if (editorObject.queryCommandValue("FontName") != null)
				{
					strStatus += editorObject.queryCommandValue("FontName") + ' ';
				}
			}
			var ctrlSize = eval("document.all."+iframeId+"_FontSize");
			if (editorObject.queryCommandSupported("FontSize") == false)
			{
				ctrlSize.disabled = true;
			}
			else
			{
				ctrlSize.disabled = false;
				ctrlSize.value = editorObject.queryCommandValue("FontSize");
				if (editorObject.queryCommandValue("FontSize") != null)
				{
					strStatus += editorObject.queryCommandValue("FontSize") + ' ';
				}
			}
		}
		if (true)
		{
			var strClass = "";
			var objRange = editorObject.selection.createRange();
			var blnInATable = false;
			var blnDisabled;
			try
			{
				var parentObject = objRange.parentElement();
				while (parentObject != null)
				{
					if (parentObject.tagName.toUpperCase() == "TABLE")
					{
						blnInATable = true;
						break;
					}
					else
					{
						var parentObject = parentObject.parentElement;
					}
				}
			if (blnInATable == true)
			{
				strClass = "BUTTONENABLED";
				blnDisabled = false;
			}
			else
			{
				strClass = "BUTTONDISABLED";
				blnDisabled = true;
			}
		}
		catch(e)  
		{
			blnInATable = false;
		}
		GetToolbarButtonRefFromAction(iframeId, "InsertTable").className = "BUTTONENABLED";
		GetToolbarButtonRefFromAction(iframeId, "InsertRow").className = strClass;
		GetToolbarButtonRefFromAction(iframeId, "InsertRow").disabled = blnDisabled;
		GetToolbarButtonRefFromAction(iframeId, "InsertColumn").className = strClass;
		GetToolbarButtonRefFromAction(iframeId, "InsertColumn").disabled = blnDisabled;
		GetToolbarButtonRefFromAction(iframeId, "InsertCell").className = strClass;
		GetToolbarButtonRefFromAction(iframeId, "InsertCell").disabled = blnDisabled;
		GetToolbarButtonRefFromAction(iframeId, "DeleteCell").className = strClass;
		GetToolbarButtonRefFromAction(iframeId, "DeleteCell").disabled = blnDisabled;
		GetToolbarButtonRefFromAction(iframeId, "DeleteColumn").className = strClass;
		GetToolbarButtonRefFromAction(iframeId, "DeleteColumn").disabled = blnDisabled;
		GetToolbarButtonRefFromAction(iframeId, "DeleteRow").className = strClass;
		GetToolbarButtonRefFromAction(iframeId, "DeleteRow").disabled = blnDisabled;
	}
	if (SHOWUNDOREDO == true)
	{
		if (IsUndoAvailable(iframeId))
		{
			GetToolbarButtonRefFromAction(iframeId, "Undo").className = "BUTTONENABLED";
			GetToolbarButtonRefFromAction(iframeId, "Undo").disabled = false;
		}
		else
		{
			GetToolbarButtonRefFromAction(iframeId, "Undo").className = "BUTTONDISABLED";
			GetToolbarButtonRefFromAction(iframeId, "Undo").disabled = true;
		}
		if (IsRedoAvailable(iframeId))
		{
			GetToolbarButtonRefFromAction(iframeId, "Redo").className = "BUTTONENABLED";
			GetToolbarButtonRefFromAction(iframeId, "Redo").disabled = false;
		}
		else
		{
			GetToolbarButtonRefFromAction(iframeId, "Redo").className = "BUTTONDISABLED";
			GetToolbarButtonRefFromAction(iframeId, "Redo").disabled = true;
		}
	}
	if (strStatus.length <= 4)
	{
		TextProperties.innerHTML = "&nbsp;";
	}
	else
	{
		TextProperties.innerText = strStatus;
	}
	if (editorObject.queryCommandState("OverWrite") == true)
	{
		ctrlInsert.style.color = 'gray';  ctrlOverwrite.style.color = 'black';
	}
	else
	{
		ctrlOverwrite.style.color = 'gray';
		ctrlInsert.style.color = 'black';
	}
}
}

function ParagraphStyle(iframeId){  var objSelectRef = eval("document.all."+iframeId+"_ParagraphStyle");  var editorObject = GetEditorRef(iframeId);  editorObject.execCommand("FormatBlock", true, objSelectRef.value);  var iframeObject = GetIFrameRef(iframeId);  iframeObject.focus();  UndoCheckPoint(iframeId, true);  ButtonStates(iframeId);  }  function FontSize(iframeId){  var objSelectRef = eval("document.all."+iframeId+"_FontSize");  var editorObject = GetEditorRef(iframeId);  editorObject.execCommand("FontSize", true, parseInt(objSelectRef.value));  var iframeObject = GetIFrameRef(iframeId);  iframeObject.focus();  UndoCheckPoint(iframeId, true);  ButtonStates(iframeId);  }  

function FontName(iframeId){  var objSelectRef = eval("document.all."+iframeId+"_FontName");  var editorObject = GetEditorRef(iframeId);  editorObject.execCommand("FontName", true, objSelectRef.value);  UndoCheckPoint(iframeId, true);  ButtonStates(iframeId);  }

var winTable = null;

function DisplayTableWindow(iframeId)
{
	strOP = "<HTML><HEAD><TITLE>Insertar Tabla</TITLE>"+  "<STYLE>.txt{width:50px;}TD{font-size:8pt;letter-spacing:-0.5pt}</STYLE>"+  "</HEAD><BODY bgcolor=buttonface topmargin=2 leftmargin=2 style='border:none;font-family:verdana;font-size:8pt;letter-spacing:-0.5pt'>"+  "<SCR" + "IPT LANGUAGE=javascript>\n"+  "<!--\n"+  "function ValidateTable(){\n"+  "if (isNaN(parseInt(PAD.value))){alert(\"Valor de relleno de celda no válido\");return false;}\n"+  "if (isNaN(parseInt(SPC.value))){alert(\"Valor de espaciado de celda no válido\");return false;}\n"+  "if (isNaN(parseInt(BRD.value))){alert(\"Valor de borde no válido\");return false;}\n"+  "if (isNaN(parseInt(ROW.value))){alert(\"Valor de filas no válido\");return false;}\n"+  "if (isNaN(parseInt(COL.value))){alert(\"Valor de columnas no válido\");return false;}\n"+  "window.opener.InsertTable(PAD.value,SPC.value,BRD.value,ROW.value,COL.value,'"+iframeId+"',window);\n"+  "}\n"+  "/" + "/-->\n"+  "</SC"+"RIPT><TABLE>"+  "<TR><TD>Relleno de Celda : </TD><TD><INPUT class=txt VALUE=2 TYPE=TEXT ID=PAD></TD></TR>"+  "<TR><TD>Espaciado entre Celdas : </TD><TD><INPUT class=txt VALUE=1 TYPE=TEXT ID=SPC></TD></TR>"+  "<TR><TD>Borde : </TD><TD><INPUT class=txt VALUE=1 TYPE=TEXT ID=BRD></TD></TR>"+  "<TR><TD>Filas : </TD><TD><INPUT class=txt VALUE=2 TYPE=TEXT ID=ROW></TD></TR>"+  "<TR><TD>Columnas : </TD><TD><INPUT class=txt VALUE=3 TYPE=TEXT ID=COL></TD></TR>"+  "<TR><TD></TD><TD><INPUT onclick=\"ValidateTable();\" TYPE=BUTTON VALUE=\"Insertar Tabla\" id=BUTTON1 name=BUTTON1></TD></TR>"+  "</TABLE></BODY></HTML>";
	try
	{
		winTable.focus();
	}
	catch(e)
	{
		winTable = null;
	}
	if (winTable == null)
	{
		winTable = window.open("about:blank", "wincolor", "width=250,height=180,toolbar=no,location=no,menubar=no,status=no,scrollbars=no,resizable=no");
		var myDoc = winTable.document;
		myDoc.open("text/html");
		myDoc.write(strOP);
		myDoc.close();
		myDoc.title = "Insertar Tabla";
	}
}  

function InsertTable(strPad,strSpace,strBord,strRows,strCols,iframeId,winRef)
{
	try
	{
		winRef.close();
		var objiframeId = eval("document.all."+iframeId);
		var strTable = "<table border='" + strBord + "' cellpadding='" + strPad + "' cellspacing='" + strSpace + "'>";
		for (intRows = 0; intRows < strRows; intRows++)
		{
			strTable += "<tr>";
			for (intCols = 0; intCols < strCols; intCols++)
			{
				strTable += "<td></td>";
			}
			strTable += "</tr>";
		}
		strTable += "</table>";
		PutHTML(iframeId, strTable);
	}
	catch(e)
	{
		alert("It was not possible to insert a table while this text is selected.");
	}
}  

function InsertRow(iframeId) {  try  {  var editorObject = GetEditorRef(iframeId);  var objRange = editorObject.selection.createRange();  var parentObject = objRange.parentElement();  while (parentObject != null)  {  if (parentObject.tagName.toUpperCase() == "TR")  {  var objRow = parentObject;  var objTable = parentObject.parentElement;  var newRow = objTable.insertRow(objRow.sectionRowIndex);  for (intCell = 0; intCell < Math.max(objTable.rows(objRow.sectionRowIndex).cells.length,1); intCell++)  {  newRow.insertCell();  }  break;  }  else {  parentObject = parentObject.parentElement;  }  }  UndoCheckPoint(iframeId, true);  ButtonStates(iframeId);  }  catch(e)  {  alert("It was not possible to insert a row while this text is selected.");  }  }  function InsertColumn(iframeId) {  try   {  var editorObject = GetEditorRef(iframeId);  var objRange = editorObject.selection.createRange();  var parentObject = objRange.parentElement();  while (parentObject != null)  {  if (parentObject.tagName.toUpperCase() == "TD")  {  objCell = parentObject;  }  else if (parentObject.tagName.toUpperCase() == "TR")  {  objRow = parentObject;  }  else if (parentObject.tagName.toUpperCase() == "TABLE")  {  objTable = parentObject;  break;  }  parentObject = parentObject.parentElement;  }  if ((objCell != null) && (objRow != null) && (objTable != null))  {  for (intRow = 0; intRow < objTable.rows.length; intRow++)  {  objTable.rows(intRow).insertCell(objCell.cellIndex);  }  }  UndoCheckPoint(iframeId, true);  ButtonStates(iframeId);  }  catch(e)  {  alert("It was not possible to insert a column while this text is selected.");  }  }  function InsertCell(iframeId) {  try   {  var editorObject = GetEditorRef(iframeId);  var objRange = editorObject.selection.createRange();  var parentObject = objRange.parentElement();  while (parentObject != null)  {  if (parentObject.tagName.toUpperCase() == "TD")  {  objCell = parentObject;  }  else if (parentObject.tagName.toUpperCase() == "TR")  {  objRow = parentObject;  break;  }  parentObject = parentObject.parentElement;  }  if ((objCell != null) && (objRow != null))  {  objRow.insertCell(objCell.cellIndex);  }  UndoCheckPoint(iframeId, true);  ButtonStates(iframeId);  }  catch(e)  {  alert("It was not possible to insert a cell while this text is selected.");  }  }  function DeleteCell(iframeId) {  try  {  var editorObject = GetEditorRef(iframeId);  var objRange = editorObject.selection.createRange();  var parentObject = objRange.parentElement();  while (parentObject != null)  {  if (parentObject.tagName.toUpperCase() == "TD")  {  objCell = parentObject;  }  else if (parentObject.tagName.toUpperCase() == "TR")  {  objRow = parentObject;  break;  }  parentObject = parentObject.parentElement;  }  if ((objCell != null) && (objRow != null))  {  objRow.deleteCell(objCell.cellIndex);  }  UndoCheckPoint(iframeId, true);  ButtonStates(iframeId);  }  catch(e)  {  alert("It was not possible to delete a cell while this text is selected.");  }  }  

function DeleteColumn(iframeId)   {  try  {  var editorObject = GetEditorRef(iframeId);  var objRange = editorObject.selection.createRange();  var parentObject = objRange.parentElement();  while (parentObject != null)  {  if (parentObject.tagName.toUpperCase() == "TD")  {  objCell = parentObject;  }  else if (parentObject.tagName.toUpperCase() == "TR")  {  objRow = parentObject;  }  else if (parentObject.tagName.toUpperCase() == "TABLE")  {  objTable = parentObject;  break;  }  parentObject = parentObject.parentElement;  }  if ((objCell != null) && (objRow != null) && (objTable != null))  {  intColumn = objCell.cellIndex;  for (intRow = 0; intRow < objTable.rows.length; intRow++)  {  if (objTable.rows(intRow).cells.length > intColumn)  {  objTable.rows(intRow).deleteCell(intColumn);  }  }  }  UndoCheckPoint(iframeId, true);  ButtonStates(iframeId);  }  catch(e)  {  alert("It was not possible to delete a column while this text is selected.");  }  }  function DeleteRow(iframeId)   {  try  {  var editorObject = GetEditorRef(iframeId);  var objRange = editorObject.selection.createRange();  var parentObject = objRange.parentElement();  while (parentObject != null)  {  if (parentObject.tagName.toUpperCase() == "TR")  {  objRow = parentObject;  }  else if (parentObject.tagName.toUpperCase() == "TABLE")  {  objTable = parentObject;  break;  }  parentObject = parentObject.parentElement;  }  if ((objRow != null) && (objTable != null))  {  objTable.deleteRow(objRow.sectionRowIndex);  }  UndoCheckPoint(iframeId, true);  ButtonStates(iframeId);  }  catch(e)  {  alert("It was not possible to delete a row while this text is selected.");  }  }  var colorWindow = null;  function DisplayColorWindow(mode,iframeId){  var colorWidth = 500;  var colorHeight = 100;  try   {  colorWindow.focus();  }  catch(e)  {  colorWindow = null;  }  if (colorWindow == null)  {  colorWindow = window.open("about:blank", "wincolor", "width=" + colorWidth + ",height=" + colorHeight + ",left=" + ((screen.width / 2) - (colorWidth / 2)) + ",top=" + ((screen.height / 4) - (colorHeight / 2)) + ",toolbar=no,location=no,menubar=no,status=no,scrollbars=no,resizable=no");  var myDoc = colorWindow.document;  colors = new Array('0','3','6','9','C','F');  strColorTable = "<TABLE onclick='assign();' onmouseover='toggleClass();' onmouseout='toggleClass();' WIDTH=100% CELLPADDING=0 CELLSPACING=0 BORDER=0>";  for(i=0;i<colors.length;i++){  strColorTable += "<TR>";  for(j=0;j<colors.length;j++){  for(k=0;k<colors.length;k++){  strColorTable += "<TD class=col bgcolor=#"+colors[k]+colors[k]+colors[i]+colors[i]+colors[j]+colors[j]+">&nbsp;</TD>";  }  }  strColorTable += "</TR>";  }  strColorTable += "</TABLE>";  colorWindow.focus();  myDoc.open("text/html");  myDoc.write("<HTML><HEAD></HEAD>"+  "<STYLE>TD{font-size:8pt;}.col{border:solid 1px buttonface;cursor:hand;}.colO{cursor:hand;border:solid 1px black;}</STYLE>"+  "<SCRIPT>\n<!--\n"+  "function toggleClass(){\n"+  "var el = window.event.srcElement;if(el.className=='col'){el.className='colO'}else if(el.className=='colO'){el.className='col'}\n"+  "}\n"+  "function assign(){\n"+  "var el = window.event.srcElement;if(el.className=='col'||el.className=='colO'){window.opener.SetColor('"+mode+"', el.bgColor, '"+iframeId+"',window);}\n"+  "}\n--></SCR"+"IPT></TABLE>"+  "<BODY bgcolor=buttonface topmargin=2 leftmargin=2 style='border:none;font-family:verdana;font-size:8pt;letter-spacing:-0.5pt' onselectstart='return false'>"+  strColorTable+  "</BODY></HTML>");  myDoc.close();  }  else {  var myDoc = colorWindow.document;  }  if(mode == "FG"){  myDoc.title = "Foreground Color - Click To Assign";  } else if(mode == "BG"){  myDoc.title = "Background Color - Click To Assign";  } else {  }  }  function SetColor(mode,color,iframeId,winRef){  colorWindow.close();  colorWindow = null;  var editorObject = GetEditorRef(iframeId);  if (mode == "BG"){  strCMD = "BackColor";  } else if (mode == "FG"){  strCMD = "ForeColor";  } else{  }  editorObject.execCommand(strCMD,true, color);  UndoCheckPoint(iframeId, true);  ButtonStates(iframeId);  } 
function ToggleSourceView(iframeId){  var iframeObject = GetIFrameRef(iframeId);  var editorObject = GetEditorRef(iframeId);  ctrlText = eval("document.all.TXT"+iframeId);  var ctrlStatusBar = eval("document.all.SB"+iframeId);  if(ctrlText.style.display == "none"){  ctrlText.value = editorObject.body.innerHTML;  ctrlText.style.width = iframeObject.clientWidth;  ctrlText.style.display = "block";  iframeObject.style.display = "none";  ctrlStatusBar.style.display = "none";  for(var i=0;i < iframeObject.toolbarArray.length; i++) {  for(var i=0;i < iframeObject.toolbarArray.length; i++) {  if (iframeObject.toolbarArray[i][BTN_PROP_TYPE] != BTN_TYPE_SRC)  {  if ((iframeObject.toolbarArray[i][BTN_PROP_TYPE] != BTN_TYPE_DROPDOWN) && (iframeObject.toolbarArray[i][BTN_PROP_TYPE] != BTN_TYPE_SPACER))  {  var ImgRef = GetToolbarButtonRefFromNumber(iframeId, i);  ImgRef.className = "BUTTONDISABLED";  ImgRef.disabled = true;  }  else {  ImgRef.disabled = true;  }  }  }  }  var ctrlPara = eval("document.all."+iframeId+"_ParagraphStyle");  var ctrlSize = eval("document.all."+iframeId+"_FontSize");  var ctrlName = eval("document.all."+iframeId+"_FontName");  ctrlPara.disabled = true;  ctrlSize.disabled = true;  ctrlName.disabled = true;  } else {  ctrlText.style.display = "none";  editorObject.body.innerHTML = ctrlText.value;  iframeObject.style.display = "block";  if (SHOWSTATUSBAR == true)  {  ctrlStatusBar.style.display = "inline";  }  else {  ctrlStatusBar.style.display = "none";  }  for(var i=0;i < iframeObject.toolbarArray.length; i++) {  if ((iframeObject.toolbarArray[i][BTN_PROP_TYPE] != BTN_TYPE_DROPDOWN) && (iframeObject.toolbarArray[i][BTN_PROP_TYPE] != BTN_TYPE_SPACER))  {  var ImgRef = GetToolbarButtonRefFromNumber(iframeId, i);  ImgRef.disabled = false;  ImgRef.className = "BUTTONENABLED";  }  }  }  }  function EditorLoaded(iframeId, strDefaultText)  {  var iframeObject = GetIFrameRef(iframeId);  var objEditor = GetEditorRef(iframeId);  var objReadOnly = eval("document.all('RO" + iframeId + "').contentWindow.document");  objEditor.body.innerHTML = strDefaultText;  objReadOnly.body.innerHTML = strDefaultText;  objEditor.body.style.cssText = BODYSTYLE;  objReadOnly.body.innerHTML = BODYSTYLE;  if (CSS_FILE != "")  {  var oLink=objEditor.createElement("LINK");  oLink.rel = 'stylesheet';  oLink.type = 'text/css';  oLink.href = CSS_FILE;  objEditor.getElementsByTagName('head')[0].appendChild(oLink);  var oLink=objReadOnly.createElement("LINK");  oLink.rel = 'stylesheet';  oLink.type = 'text/css';  oLink.href = CSS_FILE;  objReadOnly.getElementsByTagName('head')[0].appendChild(oLink);  }  var ctrlText = eval("document.all.TXT"+iframeId);  ctrlText.value = objEditor.body.innerHTML;  objEditor.onkeypress = function() { KeyPress(iframeId) };  objEditor.onkeydown = function() { KeyDown(iframeId) };  objEditor.onclick = function() { EditorDisplayChanged(iframeId) };  objEditor.ondeactivate = function() { EditorDisplayChanged(iframeId) };  objEditor.onkeyup = function() { KeyUp(iframeId) };  objEditor.onstop  = function() { Unload(iframeId) };  objEditor.body.topMargin = EDITORMARGIN;  objEditor.body.bottomMargin = EDITORMARGIN;  objEditor.body.leftMargin = EDITORMARGIN;  objEditor.body.rightMargin = EDITORMARGIN;  objReadOnly.body.topMargin = EDITORMARGIN;  objReadOnly.body.bottomMargin = EDITORMARGIN;  objReadOnly.body.leftMargin = EDITORMARGIN;  objReadOnly.body.rightMargin = EDITORMARGIN;  objEditor.body.contentEditable = true;  UndoInitialise(iframeId);  }  

function ToggleGuideLines(iframeId)  {  if (guidelinesOn == false)  {  guidelinesOn = true;  }  else {  guidelinesOn = false;  }  ApplyGuideLines(iframeId);  }  

function RemoveGuidelines(iframeId)  {  guidelinesOn = false;  ApplyGuideLines(iframeId);  } 

function ApplyGuideLines(iframeId)  {  editorObject = GetEditorRef(iframeId);  var strStyle = ' style="BORDER-RIGHT: #7F7C75 1px dashed;BORDER-TOP: #7F7C75 1px dashed;BORDER-LEFT: #7F7C75 1px dashed;BORDER-BOTTOM: #7F7C75 1px dashed;BORDER-TOP: #7F7C75 1px dashed;" ';  if (guidelinesOn == true)  {  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/BORDER-RIGHT: #7F7C75 1px dashed; /gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/BORDER-TOP: #7F7C75 1px dashed; /gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/BORDER-LEFT: #7F7C75 1px dashed; /gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/BORDER-BOTTOM: #7F7C75 1px dashed/gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/; BORDER-TOP: #7F7C75 1px dashed/gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/style=\"1: #7F7C75 1px dashed"/gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/style=\"" /gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/style=\""/gi, "");  re = new RegExp("<TABLE ", "gim");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(re, "<TABLE" + strStyle);  re = new RegExp("<TD", "gim");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(re, "<TD" + strStyle);  }  else {  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/BORDER-RIGHT: #7F7C75 1px dashed; /gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/BORDER-TOP: #7F7C75 1px dashed; /gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/BORDER-LEFT: #7F7C75 1px dashed; /gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/BORDER-BOTTOM: #7F7C75 1px dashed/gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/; BORDER-TOP: #7F7C75 1px dashed/gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/style=\"1: #7F7C75 1px dashed"/gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/style=\"" /gi, "");  editorObject.body.innerHTML = editorObject.body.innerHTML.replace(/style=\""/gi, "");  }  EditorDisplayChanged(iframeId);  }  function SetNumberedList(iframeId)  {  var editorObject = GetEditorRef(iframeId);  editorObject.execCommand("InsertOrderedList", true);  var objRange = editorObject.selection.createRange();  var blnInAList = false;  try  {  var parentObject = objRange.parentElement();  while (parentObject != null)  {  if (parentObject.tagName.toUpperCase() == "OL")  {  blnInAList = true;  break;  }  else {  var parentObject = parentObject.parentElement;  }  }  if (blnInAList == true)  {  parentObject.type = strOrderedListType;  }  ButtonStates(iframeId);  }  catch(e)  {  }  }  

function SetUnOrderedList(iframeId)  {  var editorObject = GetEditorRef(iframeId);  editorObject.execCommand("InsertUnorderedList", true);  var objRange = editorObject.selection.createRange();  var blnInAList = false;  try  {  var parentObject = objRange.parentElement();  while (parentObject != null)  {  if (parentObject.tagName.toUpperCase() == "UL")  {  blnInAList = true;  break;  }  else {  var parentObject = parentObject.parentElement;  }  }  if (blnInAList == true)  {  parentObject.type = strUnOrderedListType;  }  ButtonStates(iframeId);  }  catch(e)  {  }  }  var keyPressed = false;  

function KeyPress(iframeId)  {  keyPressed = true;  if (INSERTBRTAGONENTER == true)  {  var editorObject = GetEditorRef(iframeId);  var win = editorObject.parentWindow;  if ((win.event.keyCode == 13) && (win.event.shiftKey == false))  {  var ev = win.event;  var sel = editorObject.selection;    var r = sel.createRange();  r.pasteHTML("<BR>");   ev.cancelBubble = true;    ev.returnValue = false;    r.select();   r.moveEnd("character", 1);   r.moveStart("character", 1);   r.collapse(false);   EditorDisplayChanged(iframeId);  return false;   }  else if ((win.event.keyCode == 13) && (win.event.shiftKey == true))  {  if (INSERTPTAGONSHIFTENTER == true)  {  var ev = win.event;  var sel = editorObject.selection;    var r = sel.createRange();  r.pasteHTML("<P>");   ev.cancelBubble = true;    ev.returnValue = false;    r.select();   r.moveEnd("character", 1);   r.moveStart("character", 1);   r.collapse(false);   EditorDisplayChanged(iframeId);  return false;   }  }  }  }  var timeoutTimer = null;   

function KeyDown(iframeId)  {  var editorObject = GetEditorRef(iframeId);  var win = editorObject.parentWindow;  keyPressed = false;  if ((win.event.keyCode == 86) && (win.event.ctrlKey == true))  {  ExecuteAPaste(iframeId);  }  if (win.event.keyCode == 9)   {   var ev = win.event;  var sel = editorObject.selection;    var r = sel.createRange();  r.pasteHTML("&nbsp;&nbsp;&nbsp;");   ev.cancelBubble = true;    ev.returnValue = false;    r.select();   r.moveEnd("character", 1);   r.moveStart("character", 1);   r.collapse(false);   EditorDisplayChanged(iframeId);  return false;   }  if (timeoutTimer != null)  {  window.clearTimeout(timeoutTimer);  }  timeoutTimer = window.setTimeout("EditorDisplayChanged('" + iframeId + "');", 300);  }  function KeyUp(iframeId)  {    if (keyPressed == true)  {  UndoCheckPoint(iframeId, false);  }  }  function Unload(iframeId)  {  }  var popupSymbol;  var popupSymbolWidth = 425;  var popupSymbolHeight = 400;  function InsertSymbol(iframeId)  {  popupSymbol = window.createPopup();  var oPopupBody = popupSymbol.document.body;  oPopupBody.innerHTML = GetSymbolWindow(iframeId);  popupSymbol.show(event.clientX - popupSymbolWidth, event.clientY, popupSymbolWidth, popupSymbolHeight, document.body);  popupSymbol.document.body.onmouseup = CloseSymbol;  }  function ChosenSymbol(iframeId, strHTML)  {  PutHTML(iframeId, strHTML);  }  function CloseSymbol()  {  popupSymbol.hide();  }  function GetSymbolWindow(iframeId)  {  var pop;  var WINGDINGSTART = 33;  var WINGDINGSTOP = 255;  var SYMBOLSPERLINE = 16;  pop = "<table border='1' style='background-color:infobackground'><tr><td>";  pop += "<table>";  for (var index = WINGDINGSTART; index <= WINGDINGSTOP; index++)  {  if (((index - WINGDINGSTART) % SYMBOLSPERLINE) == 0)  {  pop += ("<tr>");  }  pop +=("<td style='cursor:hand;background-color:threedface;border-left: 1 solid threedlightshadow; border-top: 1 solid threedlightshadow; border-right: 1 solid threeddarkshadow; border-bottom: 1 solid threeddarkshadow' align='center' onmouseover='preview.innerHTML=this.innerHTML;' onmouseout='preview.innerHTML=\"\";' onmousedown='parent.ChosenSymbol(\"" + iframeId + "\", this.innerHTML);'>");  pop +=("<font face='wingdings'>&#" + index + ";</font>");  pop +=("</td>");  if (((index - WINGDINGSTART) % SYMBOLSPERLINE) == (SYMBOLSPERLINE - 1))  {  pop +=("</tr>");  }  }  pop +=("</font>");  pop +=("</table>");  pop +=("<table border='0' width='410'><tr height='60'>");  pop +=("<td width='1'>Previsualización:</td><td width='1'><font face='wingdings' size='7' id='preview'></font></td>");  pop +=("<td align='right' valign='bottom'><input type='button' value='Cerrar'></td>");  pop +=("</tr></table>");  pop += "</td></tr></table>";  return pop;  }  var popupEmoticon;  var popupEmoticonWidth = 198;  var popupEmoticonHeight = 220;  function InsertEmoticon(iframeId)  {  popupEmoticon = window.createPopup();  var oPopupBody = popupEmoticon.document.body;  oPopupBody.innerHTML = GetEmoticonWindow(iframeId);  popupEmoticon.show(event.clientX - popupEmoticonWidth, event.clientY, popupEmoticonWidth, popupEmoticonHeight, document.body);  popupEmoticon.document.body.onmouseup = CloseEmoticon;  }  

function ChosenEmoticon(iframeId, strHTML)  {  PutHTML(iframeId, strHTML);  }  

function CloseEmoticon()  {  popupEmoticon.hide();  }  

function GetEmoticonWindow(iframeId)  {  var editorObject = GetEditorRef(iframeId);  pop = "<table border='1' style='background-color:infobackground'><tr><TD>";  pop += "<table><tr>";  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/47_47.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/48_48.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/49_49.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/50_50.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/51_51.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/52_52.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/53_53.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/55_55.gif'></TD>");   pop +=("</TR><TR>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/56_56.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/57_57.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/58_58.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/59_59.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/60_60.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/61_61.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/62_62.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/63_63.gif'></TD>");   pop +=("</TR><TR>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/64_64.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/66_66.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/69_69.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/70_70.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/71_71.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/72_72.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/73_73.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/74_74.gif'></TD>");   pop +=("</TR><TR>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/75_75.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/77_77.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/angel_smile.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/angry_smile.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/bat.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/beer_mug.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/bigsmile.png'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/broken_heart.gif'></TD>");   pop +=("</TR><TR>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/cake.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/camera.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/cat.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/clock.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/coffee.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/confused_smile.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/cry_smile.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/devil_smile.gif'></TD>");   pop +=("</TR><TR>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/dog.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/envelope.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/film.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/girl.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/girl_hug.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/guy.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/guy_hug.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/heart.gif'></TD>");   pop +=("</TR><TR>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/kiss.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/lightbulb.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/martini.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/moon.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/note.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/omg_smile.gif'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/phone.gif'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/present.gif'></TD>");  pop +=("</TR><TR>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/red_smile.gif'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/regular_smile.gif'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/rose.gif'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/sad_smile.gif'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/shades_smile.gif'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/star.gif'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/surprised.png'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/teeth_smile.gif'></TD>");  pop +=("</TR><TR>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/thumbs_down.gif'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/thumbs_up.gif'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/tongue_smile.gif'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/what_smile.gif'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/wilted_rose.gif'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/wink.png'></TD>");   pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);'><IMG src='" + IMG_DIRECTORY + "Emoticons/wink_smile.gif'></TD>");  pop +=("<TD style='cursor:hand' onmousedown='parent.ChosenEmoticon(\"" + iframeId + "\", this.innerHTML);''></TD>");  pop += "</tr></table>";  pop += "</tr></table>";  return pop;  }  

function DrawStatusBar(iframeid)  {  if (SHOWSTATUSBAR == true)  {  document.write("<table width='100%' id='SB" + iframeid + "' style='display:block'>");  }  else   {  document.write("<table width='100%' id='SB" + iframeid + "' style='display:none'>");  }  document.write("<tr>");  document.write("<td width='' id='TextProperties' class='SUNKEN'>&nbsp;</td>");  document.write("<td id='Overwrite" + iframeid + "' class='SUNKEN' width='40' align='center'>OVR</td><td id='Insert" + iframeid + "' class='SUNKEN' width='40' align='center'>INS</td>");  document.write("</tr></table>");  }  var searchWin;  

function FindAndReplace(iframeId)  {  var findWidth = 430;  var findHeight = 120;  try  {  searchWin.focus();  }  catch(e)  {  searchWin = null;  }  if (searchWin == null)  {  strOP = "<HTML><HEAD><TITLE>Buscar y Reemplazar</TITLE>"+  "<SCR" + "IPT LANGUAGE=javascript>\n"+  "<!--\n"+  "var doco = eval(\"window.opener.document.all('" + iframeId + "').contentWindow.document;\");\n" +  "var oRange = doco.body.createTextRange(); \n" +   "oRange.collapse(true);\n" +   "var blnFound = false; \n" +   "function FindText(blnShowWarning){\n"+  "if (Find.value == '') { \n" +  "           alert('Se debe introducir algún texto para realizar la búsqueda.');\n" +  "    return;\n" +   "}\n" +  "oRange.collapse(false); \n" +  "if (MatchCase.checked == true) iFlag = 4; \n" +  "else iFlag = 0; \n" +   "if (oRange.findText(Find.value, 1000000, iFlag)) {   \n" +  "oRange.select(); \n" +  "blnFound = true; \n" +  "} \n" +  "else { \n " +  "blnFound = false; \n" +  "if (blnShowWarning == true) { \n" +  "alert(\"No se ha encontrado '\" + Find.value + \"'\"); \n" +  "}\n" +  "} \n" +  "}\n" +  "function Replace(){\n"+  "if (blnFound == false) { \n" +   "FindText(true); \n " +  "} \n" +  "else { \n" +  "oRange.pasteHTML(ReplaceWith.value); \n" +   "FindText(true); \n" +  "}\n" +  "}\n" +  "function ReplaceAll(){\n"+  "if (Find.value == '') { \n" +  "           alert('Se debe introducir algún texto para realizar la búsqueda.');\n" +  "    return;\n" +   "}\n" +  "oRange = doco.body.createTextRange(); \n" +   "oRange.collapse(true);\n" +   "FindText(true); \n " +  "while (blnFound == true) \n " +  "{ \n" +  "oRange.pasteHTML(ReplaceWith.value);\n" +   "FindText(false); \n " +  "} \n" +  "}\n" +  "/" + "/-->\n"+  "</SC"+"RIPT>" +  "<body leftmargin='2' topmargin='2' rightmargin='2' bottommargin='2' bgcolor='ButtonFace'>" +  "<table bgcolor='ButtonFace'>" +  "<tr>" +  "<td>Buscar:</td>" +  "<td><input type='text' id='Find' style='width:200'></td>" +  "<td><input type='button' value='Buscar Sig.' id='FindNext' style='width:100' onclick=\"FindText(true);\"></td>" +  "</tr>" +  "<tr>" +  "<td>Reemplazar:</td>" +  "<td><input type='text' size='20' id='ReplaceWith' style='width:200'></td>" +  "<td><input type='button' value='Reemplazar' id='Replace' style='width:100' onclick='Replace();'></td>" +  "</tr>" +  "<tr>" +  "<td></td>" +  "<td></td>" +  "<td><input type='button' value='Reemplazar Todos' id='ReplaceAll' style='width:100' onclick='ReplaceAll();'></td>" +  "</tr>" +  "<tr>" +  "<td nowrap><input type='checkbox' id='MatchCase'>Coincidir May.</td>" +  "<td></td>" +  "<td><input type='button' value='Cancelar' id='Cancel' style='width:100' onclick='window.close();'></td>" +  "</tr>" +  "</table>" +  "</body>" +  "</html>";  searchWin = window.open("about:blank", "wincolor", "width=" + findWidth + ",height=" + findHeight + ",left=" + ((screen.width / 2) - (findWidth / 2)) + ",top=" + ((screen.height / 4) - (findHeight / 2)) + ",toolbar=no,location=no,menubar=no,status=no,scrollbars=no,resizable=no");  var myDoc = searchWin.document;  myDoc.open("text/html");  myDoc.write(strOP);  myDoc.close();  myDoc.title = "Buscar y Reemplazar";  UndoCheckPoint(iframeId, true);  ButtonStates(iframeId);  }  }  

var winLibrary;  

function AddFromLibrary(iframeId) 
{
	if (window.location.href.substring(0,5).toLowerCase() != 'file:')
	{
		try
		{
			winLibrary.focus();
		}
		catch(e)
		{
			winLibrary = null;
		}
		if (winLibrary == null)
		{
			winLibrary = window.open(IMAGELIBRARY + '?iframeid=' + iframeId, null, "width=780,height=440,toolbar=no,location=no,menubar=no,status=no,scrollbars=yes,resizable=no");
		}
	}
	else
	{
		alert("This functionality is not available while the HTML Rich Text Area is running off your hard drive.  It must be deployed to an IIS web server for it to work.");
	}
}

function InsertImageFromLibrary(iframeId, strURL)
{
	PutHTML(iframeId, "<img src='" + strURL + "'>");
}

function ClearFormatting(iframeId)  {  var editorObject = GetEditorRef(iframeId);  editorObject.execCommand('RemoveFormat');  if (editorObject.queryCommandSupported("Unlink") == true)  {  editorObject.execCommand("Unlink");  }  UndoCheckPoint(iframeId, true);  ButtonStates(iframeId);  }  

function InsertDate(iframeId)  {  var d = new Date();  var s = d.toLocaleDateString();  PutHTML(iframeId, s);  }  

function InsertTime(iframeId)  {  var d = new Date();  var s = d.toLocaleTimeString();  PutHTML(iframeId, s);  }  function GetEditorRef(iframeId)  {  return eval("document.all('" + iframeId + "').contentWindow.document");  }  function GetIFrameRef(iframeId)   {  return eval("document.all('" + iframeId + "')");  }  function ActivateEditor(iframeId)  {  var editorObject = GetEditorRef(iframeId);  var editorRange = editorObject.body.createTextRange();             var curRange = editorObject.selection.createRange();            if (curRange.length == null &&  !editorRange.inRange(curRange)) {                         editorRange.collapse();                                     editorRange.select();                                       }      }  function PutHTML(iframeId, strHTML)  {  try {  ActivateEditor(iframeId);  var editorObject = GetEditorRef(iframeId);  var objRange = editorObject.selection.createRange();  objRange.pasteHTML(strHTML);   }  catch(e)  {  alert("It was not possible to insert the text at this place in the document.");  }  UndoCheckPoint(iframeId, true);  ButtonStates(iframeId);  }  function GetToolbarButtonRefFromNumber(iframeId, buttonNumber)  {  var iframeObject = GetIFrameRef(iframeId);  var strCmd = iframeObject.toolbarArray[buttonNumber][BTN_PROP_CMDID];  return eval("document.all."+iframeId+strCmd);  }  function GetToolbarButtonRefFromAction(iframeId, strAction)  {  return eval("document.all."+iframeId+strAction);  }  function ExecuteAPaste(iframeId)  {  var editorObject = GetEditorRef(iframeId);  var win = editorObject.parentWindow;  var ev = win.event;  var sel = editorObject.selection;    var r = sel.createRange();  if (CheckPaste() == true)  {  r.pasteHTML(GetFormattedClipboardData());   }  else {  r.pasteHTML(clipboardData.getData("Text"));   }  if (ev != null)  {  ev.cancelBubble = true;    ev.returnValue = false;    }  r.select();   r.moveEnd("character", 1);   r.moveStart("character", 1);   r.collapse(false);   UndoCheckPoint(iframeId, true);  EditorDisplayChanged(iframeId);  return false;   }  function CheckPaste(formattedClipboardData)  {  return true;  }  function GetFormattedClipboardData()  {  var strText = clipboardData.getData("Text");  while (strText.indexOf("\n") > 0)  {  strText = strText.replace("\n","<br>");  }  return strText;  }  function UndoManager(iframeId)  {  var objIframe = GetIFrameRef(iframeId);  var objEditor = GetEditorRef(iframeId);  if (objIframe.undoPosition == 0)  {  alert('No es posible deshacer más.');  }  else {  objIframe.undoPosition--;  objEditor.body.innerHTML = objIframe.undoData[objIframe.undoPosition];  }  }  function RedoManager(iframeId)  {  var objIframe = GetIFrameRef(iframeId);  var objEditor = GetEditorRef(iframeId);  if (objIframe.undoPosition == objIframe.undoData.length - 1)  {  alert('No hay nada que rehacer.');  }  else {  objIframe.undoPosition++;  objEditor.body.innerHTML = objIframe.undoData[objIframe.undoPosition];  }  }  

function IsUndoAvailable(iframeId)  {  var objIframe = GetIFrameRef(iframeId);  if (objIframe.undoPosition == 0)  {  return false;  }  else   {  return true;  }  }  function IsRedoAvailable(iframeId)  {  var objIframe = GetIFrameRef(iframeId);  if (objIframe.undoPosition == objIframe.undoData.length - 1)  {  return false;  }  else   {  return true;  }  }  var undoTimer = null;  function UndoCheckPoint(iframeId, blnForce)  {  var objIframe = GetIFrameRef(iframeId);  var objEditor = GetEditorRef(iframeId);  if (blnForce == true)  {  if (undoTimer != null)  {  window.clearTimeout(undoTimer);  undoTimer = null;  }  if (objIframe.undoPosition < objIframe.undoData.length - 1)  {  objIframe.undoData = objIframe.undoData.slice(0, objIframe.undoPosition + 1);  }  objIframe.undoData.push(objEditor.body.innerHTML);  objIframe.undoPosition = objIframe.undoData.length - 1;  if (objIframe.undoData.length > MAXUNDOSIZE)  {  objIframe.undoData.shift();  objIframe.undoPosition--;  if (objIframe.undoPosition < 0)  {  objIframe.undoPosition = 0;  }  }  ButtonStates(iframeId);  }  else {  if (undoTimer != null)  {  window.clearTimeout(undoTimer);  undoTimer = null;  }  undoTimer = window.setTimeout("UndoCheckPoint('" + iframeId + "', true);", 500);  }  }  function UndoInitialise(iframeId)  {  var objIframe = GetIFrameRef(iframeId);  objIframe.undoPosition = -1;  objIframe.undoData = new Array();  UndoCheckPoint(iframeId, true);  } 

function pushItem(array, item)
{  
	array[array.length] = item;
}  

