<%
   /* Check whether browser is MSFT IE and store result in pageContext */
   pageContext.setAttribute("IE", new Boolean(request.getHeader("User-Agent").indexOf("MSIE")>-1));
%>

<%--
Use JSTL to determine whether the client browser is MSFT IE.
In case of MSFT IE use MS-HTML specific Rich-Text editor (CONTENTEDITABLE),
otherwise use simple HTML textarea.
--%>
<c:choose>
<c:when test="${IE}">
<script>
function edit_<c:out value="${editor}"/>(sEvent,sValue)
{
   div_<c:out value="${editor}"/>.focus()
   document.focus()
   var oSelection = document.selection.createRange()
   document.execCommand(sEvent,false,sValue)
}
</script>
<div ID="<c:out value="${editor}"/>Toolbar" STYLE="width:95%; background-color:CFCFCF;">
<select ID="<c:out value="${editor}"/>Font" NAME="FontName"
   onChange="edit_<c:out value="${editor}"/>(document.FAQForm.<c:out value="${editor}"/>Font.name,
      document.FAQForm.<c:out value="${editor}"/>Font.options[document.FAQForm.<c:out value="${editor}"/>Font.selectedIndex].value);">
   <option VALUE="" SELECTED>Font</option>
   <option VALUE="Arial">Arial</option>
   <option VALUE="Arial Black">Arial Black</option>
   <option VALUE="Arial Narrow">Arial Narrow</option>
   <option VALUE="Comic Sans MS">Comic Sans MS</option>
   <option VALUE="Courier New">Courier New</option>
   <option VALUE="Time New Roman">Time New Roman</option>
   <option VALUE="System">System</option>
   <option VALUE="Verdana">Verdana</option>
   <option VALUE="Wingdings">Wingdings</option>
</select>
<select ID="<c:out value="${editor}"/>FontSize" NAME="FontSize"
   onChange="edit_<c:out value="${editor}"/>(document.FAQForm.<c:out value="${editor}"/>FontSize.name,
      document.FAQForm.<c:out value="${editor}"/>FontSize.options[document.FAQForm.<c:out value="${editor}"/>FontSize.selectedIndex].value);">
   <option VALUE="" SELECTED>Size</option>
   <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>
&nbsp;
<button onClick=edit_<c:out value="${editor}"/>("cut")>Cut</button>
<button onClick=edit_<c:out value="${editor}"/>("copy")>Copy</button>
<button onClick=edit_<c:out value="${editor}"/>("paste")>Paste</button>
&nbsp;
<button onClick=edit_<c:out value="${editor}"/>("bold")><b>Bold</b></button>
<button onClick=edit_<c:out value="${editor}"/>("italic")><i>Italic</i></button>
<button onClick=edit_<c:out value="${editor}"/>("underline")><u>Underline</u></button>
</div>
<div ID=div_<c:out value="${editor}"/> CONTENTEDITABLE align=left STYLE="height:150;
 width:95%;background-color:white; padding:3; border:inset; overflow=auto;"><bean:write name="FAQForm" property="<%=pageContext.getAttribute(\"editor\")%>" filter="false"/></div>
<html:hidden property="<%=pageContext.getAttribute(\"editor\")%>"/>
</c:when>
<c:otherwise>
   <div><html:textarea property="<%=pageContext.getAttribute(\"editor\")%>" rows="10" cols="80"/></div>
</c:otherwise>
</c:choose>

