1 ////////////////////////////////////////////////////////////////////////////////
3 // Richtext Editor: Fork (RTEF) VERSION: 0.002
5 // For the latest release visit http://richtext.cabspace.com
6 // For support visit http://cabspace.com/forums/?mforum=richtext
8 ////////////////////////////////////////////////////////////////////////////////
10 ////////////////////////////////////////////////////////////////////////////////
14 // Copyright (c) 2006 Timothy Bell
16 // Permission is hereby granted, free of charge, to any person obtaining a copy
17 // of this software and associated documentation files (the "Software"), to deal
18 // in the Software without restriction, including without limitation the rights
19 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
20 // copies of the Software, and to permit persons to whom the Software is
21 // furnished to do so, subject to the following conditions:
23 // The above copyright notice and this permission notice shall be included in
24 // all copies or substantial portions of the Software.
26 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
27 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
28 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
29 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
30 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
31 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
34 ////////////////////////////////////////////////////////////////////////////////
37 var minWidth = 450; // minumum width
38 var wrapWidth = 1245; //width at which all icons will appear on one bar
39 var maxchar = 64000; // maximum number of characters per save
40 var lang = "en"; //xhtml language
41 var lang_direction = "ltr"; //language direction : ltr = left-to-right, rtl = right-to-left
42 var encoding = "utf-8"; //xhtml encoding
43 var zeroBorder = "#c0c0c0"; //guideline color - see showGuidelines()
44 var btnText = "submit"; //Button value for non-designMode() & fullsceen rte
45 var resize_fullsrcreen = true;
46 // (resize_fullsrcreen) limited in that: 1)won't auto wrap icons. 2)won't
47 // shrink to less than (wrapWidth)px if screen was initized over (wrapWidth)px;
49 var keep_absolute = true; // !!!Disabled - see line 456 for details!!!!!
50 // By default IE will try to convery all hyperlinks to absolute paths. By
51 // setting this value to "false" it will retain the relative path.
62 //Init Variables & Attributes
63 var ua = navigator.userAgent.toLowerCase();
64 var isIE = ((ua.indexOf("msie") != -1) && (ua.indexOf("opera") == -1) && (ua.indexOf("webtv") == -1))? true:false;
65 var isIE7 = ((isIE) && (ua.indexOf("msie 7.") != -1))? true:false;
66 var isGecko = (ua.indexOf("gecko") != -1)? true:false;
67 var isSafari = (ua.indexOf("safari") != -1)? true:false;
68 var safariVersion = parseFloat(ua.substring(ua.lastIndexOf("safari/") + 7));
69 var isKonqueror = (ua.indexOf("konqueror") != -1)? true:false;
78 var generateXHTML = true;
79 var isRichText = false;
80 //check to see if designMode mode is available
81 //Safari/Konqueror think they are designMode capable even though they are not
82 //if(document.getElementById && document.designMode && !isSafari && !isKonqueror){
83 if(document.getElementById && document.designMode) {
85 } else if ((isSafari && safariVersion >= 312) || isKonqueror) {
86 //Safari 1.3+ is capable of designMode, Safari 1.3 = webkit build 312
89 //for testing standard textarea, uncomment the following line
92 var replacements = new Array (
93 new RegExp(String.fromCharCode(145),'g'), "'",
94 new RegExp(String.fromCharCode(146),'g'), "'",
95 new RegExp("'"), "'",
96 //convert all types of double quotes
97 new RegExp(String.fromCharCode(147),'g'), "\"",
98 new RegExp(String.fromCharCode(148),'g'), "\"",
99 new RegExp("\""), """, //doesn't work
100 //replace carriage returns & line feeds
101 new RegExp("[\r\n]",'g'), " ");
103 function rteSafe(html) {
105 for (i=0; i<replacements.length; i = i+2) {
106 html = html.replace(replacements[i], replacements[i+1]);
112 var nbcommand = 0; // For not duplicating separators when no command between
113 var defaultFont = "Times New Roman, Times, serif";
114 var defaultSize = "13px";
115 var activeCommand = { // Strait-forward HashMap
116 put : function(foo, bar) {this[foo] = bar;},
117 get : function(foo) {return this[foo];}
120 function initTextInput() {
121 activeCommand.put("cut", lblCut);
122 activeCommand.put("copy", lblCopy);
123 activeCommand.put("paste", lblPaste);
124 activeCommand.put("undo", lblUndo);
125 activeCommand.put("redo", lblRedo);
126 activeCommand.put("bold", lblBold);
127 activeCommand.put("italic", lblItalic);
128 activeCommand.put("underline", lblUnderline);
129 activeCommand.put("list", lblUL);
130 activeCommand.put("numbered_list", lblOL);
131 activeCommand.put("indent", lblIndent);
132 activeCommand.put("outdent", lblOutdent);
133 activeCommand.put("replace", lblSearch);
134 activeCommand.put("hyperlink", lblInsertLink);
137 defaultFont = "Arial, Helvetica, sans-serif";
138 initRTE("../rtef/images/", "", "", true);
141 function initTextEditor() {
142 activeCommand.put("save", lblSave);
143 // activeCommand.put("print", lblPrint);
144 activeCommand.put("cut", lblCut);
145 activeCommand.put("copy", lblCopy);
146 activeCommand.put("paste", lblPaste);
147 activeCommand.put("undo", lblUndo);
148 activeCommand.put("redo", lblRedo);
149 activeCommand.put("bold", lblBold);
150 activeCommand.put("italic", lblItalic);
151 activeCommand.put("underline", lblUnderline);
152 activeCommand.put("list", lblUL);
153 activeCommand.put("numbered_list", lblOL);
154 activeCommand.put("indent", lblIndent);
155 activeCommand.put("outdent", lblOutdent);
156 activeCommand.put("replace", lblSearch);
157 activeCommand.put("hyperlink", lblInsertLink);
160 defaultFont = "Arial, Helvetica, sans-serif";
161 initRTE("../rtef/images/", "", "", true);
164 function addCommand(name, action) {
165 var label = activeCommand.get(name);
167 insertImg(label, name + ".gif", action);
172 function displayTextEditor(inputname, initialtext, width, height) {
173 writeRichText(inputname, rteSafe(initialtext), '', width, height, true, false, false);
177 function initRTE(imgPath, incPath, css, genXHTML){
178 // CM 05/04/05 check args for compatibility with old RTE implementations
179 if (arguments.length == 3) {
180 genXHTML = generateXHTML;
183 imagesPath = imgPath;
184 includesPath = incPath;
186 generateXHTML = genXHTML;
188 document.writeln('<style type="text/css">@import "' + includesPath + 'rte.css";</style>');
191 minWidth = minWidth-48;
192 wrapWidth = wrapWidth-102;
196 function writeRichText(rte, html, css, width, height, buttons, readOnly, fullscreen) {
198 if(allRTEs.length > 0){
202 // CM 06/04/05 stops single quotes from messing everything up
203 html=replaceIt(html,'\'',''');
204 // CM 05/04/05 a bit of juggling for compatibility with old RTE implementations
205 if (arguments.length == 6) {
213 var iconWrapWidth = wrapWidth;
219 readOnly = false; // fullscreen is not readOnly and must show buttons
221 // resize rte on resize if the option resize_fullsrcreen = true.
222 if(isRichText && resize_fullsrcreen) {
223 window.onresize = resizeRTE;
225 document.body.style.margin = "0px";
226 document.body.style.overflow = "hidden";
227 //adjust maximum table widths
230 if(width < iconWrapWidth) {
231 height = (obj_height - 83);
233 height = (obj_height - 55);
235 if (width < minWidth) {
236 document.body.style.overflow = "auto";
238 height = obj_height-22;
240 height = obj_height-24;
247 iconWrapWidth = iconWrapWidth-25;
248 //adjust minimum table widths
249 if(buttons && (width < minWidth)) {
255 tablewidth = width + 4;
265 document.writeln('<span class="rteDiv">');
267 document.writeln('<table class="rteBk" cellpadding=0 cellspacing=0 id="Buttons1_'+rte+'" width="' + tablewidth + '">');
268 document.writeln('<tbody><tr>');
270 if(fullscreen || activeCommand.get("save") != null){
271 document.writeln('<td><input type=image class="rteImg" src="'+imagesPath+'save.gif" alt="'+lblSave+'" title="'+lblSave+'" onmouseover="this.className=\'rteImgUp\'" onmouseout="this.className=\'rteImg\'" onmousedown="this.className=\'rteImgDn\'" onmouseup="this.className=\'rteImgUp\'" onClick="submitEdit()"></td>');
274 if(!isSafari && !isKonqueror) {
275 addCommand("print","rtePrint('"+rte+"')");
276 // insertImg(lblPrint,"print.gif","rtePrint('"+rte+"')");
278 addCommand("selectall","toggleSelection('"+rte+"')");
279 // insertImg(lblSelectAll,"selectall.gif","toggleSelection('"+rte+"')");
280 addCommand("unformat","rteCommand('"+rte+"','removeformat')");
281 // insertImg(lblUnformat,"unformat.gif","rteCommand('"+rte+"','removeformat')");
284 if(isIE || isSafari || isKonqueror) {
285 addCommand("cut","rteCommand('"+rte+"','cut')");
286 // insertImg(lblCut,"cut.gif","rteCommand('"+rte+"','cut')");
287 addCommand("copy","rteCommand('"+rte+"','copy')");
288 // insertImg(lblCopy,"copy.gif","rteCommand('"+rte+"','copy')");
290 if(isSafari || isKonqueror) {
291 addCommand("paste","rteCommand('"+rte+"','InsertText')");
292 // insertImg(lblPaste,"paste.gif","rteCommand('"+rte+"','InsertText')");
295 addCommand("paste","rteCommand('"+rte+"','paste')");
296 // insertImg(lblPaste,"paste.gif","rteCommand('"+rte+"','paste')");
298 if(!isSafari && !isKonqueror) {
299 addCommand("pastetext","dlgLaunch('"+rte+"','text')");
300 // insertImg(lblPasteText,"pastetext.gif","dlgLaunch('"+rte+"','text')");
301 addCommand("pasteword","dlgLaunch('"+rte+"','word')");
302 // insertImg(lblPasteWord,"pasteword.gif","dlgLaunch('"+rte+"','word')");
305 addCommand("undo","rteCommand('"+rte+"','undo')");
306 // insertImg(lblUndo,"undo.gif","rteCommand('"+rte+"','undo')");
307 addCommand("redo","rteCommand('"+rte+"','redo')");
308 // insertImg(lblRedo,"redo.gif","rteCommand('"+rte+"','redo')");
309 if(!isSafari && !isKonqueror) {
311 // document.writeln('<td>');
312 // document.writeln('<select id="formatblock_'+rte+'" onchange="selectFont(\''+rte+'\', this.id);return false" style="font-size:14px;width:105px;height:20px;margin:1px;">');
313 // document.writeln(lblFormat);
314 // document.writeln('</select></td><td>');
315 // document.writeln('<select id="fontname_'+rte+'" onchange="selectFont(\''+rte+'\', this.id);return false" style="font-size:14px;width:125px;height:20px;margin:1px;">');
316 // document.writeln(lblFont);
317 // document.writeln('</select></td><td>');
318 // document.writeln('<select unselectable="on" id="fontsize_'+rte+'" onchange="selectFont(\''+rte+'\', this.id);return false" style="font-size:14px;width:75px;height:20px;margin:1px;">');
319 // document.writeln(lblSize);
320 // document.writeln('</select></td>');
322 if(tablewidth < iconWrapWidth){
323 document.writeln('<td width="100%"></td></tr></tbody></table>');
324 document.writeln('<table class="rteBk" cellpadding="0" cellspacing="0" id="Buttons2_'+rte+'" width="' + tablewidth + '">');
325 document.writeln('<tbody><tr>');
328 addCommand("bold","rteCommand('"+rte+"','bold')");
329 // insertImg(lblBold,"bold.gif","rteCommand('"+rte+"','bold')");
330 addCommand("italic","rteCommand('"+rte+"','italic')");
331 // insertImg(lblItalic,"italic.gif","rteCommand('"+rte+"','italic')");
332 addCommand("underline","rteCommand('"+rte+"','underline')");
333 // insertImg(lblUnderline,"underline.gif","rteCommand('"+rte+"','underline')");
334 //if(!isSafari && !isKonqueror) insertImg(lblStrikeThrough,"strikethrough.gif","rteCommand('"+rte+"','strikethrough')");
335 //insertImg(lblSuperscript,"superscript.gif","rteCommand('"+rte+"','superscript')");
336 //if(!isSafari && !isKonqueror){
337 //insertImg(lblSubscript,"subscript.gif","rteCommand('"+rte+"','subscript')");
339 //insertImg(lblSubscript,"subscript.gif","rteCommand('"+rte+"','StyleChange',sub)");
342 addCommand("left_just","rteCommand('"+rte+"','justifyleft')");
343 // insertImg(lblAlgnLeft,"left_just.gif","rteCommand('"+rte+"','justifyleft')");
344 addCommand("centre","rteCommand('"+rte+"','justifycenter')");
345 // insertImg(lblAlgnCenter,"centre.gif","rteCommand('"+rte+"','justifycenter')");
346 addCommand("right_just","rteCommand('"+rte+"','justifyright')");
347 // insertImg(lblAlgnRight,"right_just.gif","rteCommand('"+rte+"','justifyright')");
348 addCommand("justifyfull","rteCommand('"+rte+"','justifyfull')");
349 // insertImg(lblJustifyFull,"justifyfull.gif","rteCommand('"+rte+"','justifyfull')");
350 if(!isSafari && !isKonqueror) {
352 addCommand("numbered_list","rteCommand('"+rte+"','insertorderedlist')");
353 // insertImg(lblOL,"numbered_list.gif","rteCommand('"+rte+"','insertorderedlist')");
354 addCommand("list","rteCommand('"+rte+"','insertunorderedlist')");
355 // insertImg(lblUL,"list.gif","rteCommand('"+rte+"','insertunorderedlist')");
356 addCommand("outdent","rteCommand('"+rte+"','outdent')");
357 // insertImg(lblOutdent,"outdent.gif","rteCommand('"+rte+"','outdent')");
358 addCommand("indent","rteCommand('"+rte+"','indent')");
359 // insertImg(lblIndent,"indent.gif","rteCommand('"+rte+"','indent')");
361 addCommand("textcolor","dlgColorPalette('"+rte+"','forecolor')","forecolor_"+rte);
362 // insertImg(lblTextColor,"textcolor.gif","dlgColorPalette('"+rte+"','forecolor')","forecolor_"+rte);
363 addCommand("bgcolor","dlgColorPalette('"+rte+"','hilitecolor')","hilitecolor_"+rte);
364 // insertImg(lblBgColor,"bgcolor.gif","dlgColorPalette('"+rte+"','hilitecolor')","hilitecolor_"+rte);
366 addCommand("hr","rteCommand('"+rte+"','inserthorizontalrule')");
367 // insertImg(lblHR,"hr.gif","rteCommand('"+rte+"','inserthorizontalrule')");
369 addCommand("special_char","dlgLaunch('"+rte+"','char')");
370 // insertImg(lblInsertChar,"special_char.gif","dlgLaunch('"+rte+"','char')");
371 addCommand("hyperlink","dlgLaunch('"+rte+"','link')");
372 // insertImg(lblInsertLink,"hyperlink.gif","dlgLaunch('"+rte+"','link')");
373 addCommand("image","dlgLaunch('"+rte+"','image')");
374 // insertImg(lblAddImage,"image.gif","dlgLaunch('"+rte+"','image')");
375 addCommand("insert_table","dlgLaunch('"+rte+"','table')");
376 // insertImg(lblInsertTable,"insert_table.gif","dlgLaunch('"+rte+"','table')");
379 if(!isSafari && !isKonqueror) {
380 addCommand("replace","dlgLaunch('"+rte+"','replace')");
381 // insertImg(lblSearch,"replace.gif","dlgLaunch('"+rte+"','replace')");
383 addCommand("word_count","countWords('"+rte+"')");
384 // insertImg(lblWordCount,"word_count.gif","countWords('"+rte+"')");
386 addCommand("spellcheck","checkspell()");
387 // insertImg(lblSpellCheck,"spellcheck.gif","checkspell()");
389 document.writeln('<td width="100%"></td></tr></tbody></table>');
391 document.writeln('<iframe id="'+rte+'" width="' + (tablewidth - 2) + 'px" height="' + height + 'px" frameborder=0 style="border: 1px solid #d2d2d2" src="' + includesPath + 'blank.htm" onfocus="dlgCleanUp();"></iframe>');
393 document.writeln('<table id="vs'+rte+'" name="vs'+rte+'" class="rteBk" cellpadding=0 cellspacing=0 border=0 width="' + tablewidth + '"><tr>');
394 document.writeln('<td onclick="toggleHTMLSrc(\''+rte+'\', ' + buttons + ');" nowrap><img class="rteBar" src="'+imagesPath+'bar.gif" alt="" align=absmiddle><span id="imgSrc'+rte+'"><img src="'+imagesPath+'code.gif" alt="" title="" style="margin:1px;" align=absmiddle></span><span id="_xtSrc'+rte+'" style="font-family:tahoma,sans-serif;font-size:12px;color:#0000ff;CURSOR: default;">'+lblModeHTML+'</span></td>');
395 document.writeln('<td width="100%" nowrap> </td></tr></table>');
397 document.writeln('<iframe width="142" height="98" id="cp'+rte+'" src="' + includesPath + 'palette.htm" scrolling="no" frameborder=0 style="margin:0;border:0;visibility:hidden;position:absolute;border:1px solid #cdcdcd;top:-1000px;left:-1000px"></iframe>');
398 document.writeln('<input type="hidden" id="hdn'+rte+'" name="'+rte+'" value="" style="position: absolute;left:-1000px;top:-1000px;">');
400 document.writeln('<input type="hidden" id="size'+rte+'" name="size'+rte+'" value="'+height+'" style="position: absolute;left:-1000px;top:-1000px;">');
402 document.writeln('</span>');
403 document.getElementById('hdn'+rte).value = html;
404 enableDesignMode(rte, html, rte_css, readOnly);
407 if(fullscreen && height > 90) {
408 height = (height - 75);tablewidth=tablewidth-30;
410 // CM non-designMode() UI
411 html = parseBreaks(html);
412 document.writeln('<div style="font:12px Verdana, Arial, Helvetica, sans-serif;width: ' + tablewidth + 'px;padding:15px;">');
414 document.writeln('<div style="color:gray">'+lblnon_designMode+'</div><br>');
415 document.writeln('<input type="radio" name="' + rte + '_autobr" value="1" checked="checked" onclick="autoBRon(\'' + rte + '\');" /> '+lblAutoBR+'<input type="radio" name="' + rte + '_autobr" value="0" onclick="autoBRoff(\'' + rte + '\');" />'+lblRawHTML+'<br>');
416 document.writeln('<textarea name="'+rte+'" id="'+rte+'" style="width: ' + tablewidth + 'px; height: ' + height + 'px;">' + html + '</textarea>');
418 document.writeln('<textarea name="'+rte+'" id="'+rte+'" style="width: ' + tablewidth + 'px; height: ' + height + 'px;" readonly=readonly>' + html + '</textarea>');
420 if(fullscreen) document.writeln('<br><input type="submit" value="'+btnText+'" />');
421 document.writeln('</div>');
425 function insertBar() {
426 document.writeln('<td><img class="rteBar" src="'+imagesPath+'bar.gif" alt=""></td>');
429 function insertSep() {
431 document.writeln('<td><img class="rteSep" src="'+imagesPath+'blackdot.gif" alt=""></td>');
435 function insertImg(name, image, command, id){
438 td = "<td id='"+id+"'>";
440 document.writeln(td+'<img class="rteImg" src="'+imagesPath+image+'" alt="'+name+'" title="'+name+'" onMouseDown="'+command+';return false" onmouseover="this.className=\'rteImgUp\'" onmouseout="this.className=\'rteImg\'" onmousedown="this.className=\'rteImgDn\'" onmouseup="this.className=\'rteImgUp\'"></td>');
443 function enableDesignMode(rte, html, css, readOnly) {
444 var frameHtml = "<html dir='" + lang_direction + "' lang='" + lang + "' id='" + rte + "'>\n<head>\n";
445 frameHtml += "<meta http-equiv='Content-Type' content='text/html; charset=" + encoding + "'>\n";
446 frameHtml += "<meta http-equiv='Content-Language' content='" + lang + "'>\n";
447 //to reference your stylesheet, set href property below to your stylesheet path and uncomment
449 frameHtml += "<link media=\"all\" type=\"text/css\" href=\"" + css + "\" rel=\"stylesheet\">\n";
451 frameHtml += "<style>@charset \"utf-8\"; body {background:#FFFFFF;margin:8px;padding:0px;font-family:"+defaultFont+";font-size:"+defaultSize+";}</style>\n";
453 frameHtml += "</head><body>\n"+html+"\n</body></html>";
454 if(!isSafari && !isKonqueror) var oRTE = returnRTE(rte).document;
456 if(isSafari || isKonqueror) var oRTE = frames[rte].document;
457 oRTE.open("text/html","replace");
458 oRTE.write(frameHtml);
461 oRTE.designMode = "On";
465 // Commented out the following line to confront a bug when loading multiple RTEs on one page in a MOZ browser
466 // Fix provided by "Kings". Safari may have problems with this snytax - unable to test because I don't own a MAC.(Tim Bell)
468 // if(!readOnly) document.getElementById(rte).contentDocument.designMode = "on";
469 if(!readOnly && !isKonqueror && !isSafari) {
470 addLoadEvent(function() { document.getElementById(rte).contentDocument.designMode = "on"; });
471 } else if(!readOnly) {
472 if (!readOnly) document.getElementById(rte).contentDocument.designMode = "on";
476 if(isSafari || isKonqueror) var oRTE = document.getElementById(rte).contentWindow.document;
477 oRTE.open("text/html","replace");
478 oRTE.write(frameHtml);
480 if(isGecko && !readOnly) {
481 //attach a keyboard handler for gecko browsers to make keyboard shortcuts work
482 oRTE.addEventListener("keypress", geckoKeyPress, true);
483 oRTE.addEventListener("focus", function (){dlgCleanUp();}, false);
486 alert(lblErrorPreload);
489 //gecko may take some time to enable design mode.
490 //Keep looping until able to set.
492 setTimeout("enableDesignMode('"+rte+"', '"+html+"', '"+css+"', "+readOnly+");", 200);
498 setTimeout('showGuidelines("'+rte+'")',300);
501 function addLoadEvent(func) {
502 var oldonload = window.onload;
503 if (typeof window.onload != 'function') {
504 window.onload = func;
506 window.onload = function() {
513 function returnRTE(rte) {
518 rtn = document.getElementById(rte).contentWindow;
523 function updateRTE(rte) {
525 dlgCleanUp(); // Closes Pop-ups
526 stripGuidelines(rte); // Removes Table Guidelines
531 function updateRTEs(){
532 var vRTEs = allRTEs.split(";");
533 for(var i=0; i<vRTEs.length; i++){
538 function parseRTE(rte) {
540 autoBRoff(rte); // sorts out autoBR
543 //check for readOnly mode
544 var readOnly = false;
545 var oRTE = returnRTE(rte);
547 if(oRTE.document.designMode != "On"){
551 if(oRTE.document.designMode != "on"){
555 if(isRichText && !readOnly){
556 //if viewing source, switch back to design view
557 if(document.getElementById("_xtSrc"+rte).innerHTML == lblModeRichText){
558 if(document.getElementById("Buttons1_"+rte)){
559 toggleHTMLSrc(rte, true);
561 toggleHTMLSrc(rte, false);
563 stripGuidelines(rte);
569 function setHiddenVal(rte){
570 //set hidden form field value for current rte
571 var oHdnField = document.getElementById('hdn'+rte);
572 //convert html output to xhtml (thanks Timothy Bell and Vyacheslav Smolin!)
573 if(oHdnField.value==null){
574 oHdnField.value = "";
576 var sRTE = returnRTE(rte).document.body;
579 oHdnField.value = getXHTML(sRTE.innerHTML);
581 oHdnField.value = sRTE.innerHTML;
584 oHdnField.value = sRTE.innerHTML;
586 // fix to replace special characters added here:
587 oHdnField.value = replaceSpecialChars(oHdnField.value);
588 //if there is no content (other than formatting) set value to nothing
589 if(stripHTML(oHdnField.value.replace(" ", " ")) == "" &&
590 oHdnField.value.toLowerCase().search("<hr") == -1 &&
591 oHdnField.value.toLowerCase().search("<img") == -1){
592 oHdnField.value = "";
596 function rteCommand(rte, command, option){
598 //function to perform command
599 var oRTE = returnRTE(rte);
602 oRTE.document.execCommand(command, false, option);
606 // setTimeout("rteCommand('" + rte + "', '" + command + "', '" + option + "');", 10);
610 function toggleHTMLSrc(rte, buttons){
612 //contributed by Bob Hutzel (thanks Bob!)
613 var cRTE = document.getElementById(rte);
614 var hRTE = document.getElementById('hdn'+rte);
615 var sRTE = document.getElementById("size"+rte);
616 var tRTE = document.getElementById("_xtSrc"+rte);
617 var iRTE = document.getElementById("imgSrc"+rte);
618 var oRTE = returnRTE(rte).document;
621 obj_height = parseInt(sRTE.value);
625 if(tRTE.innerHTML == lblModeHTML){
626 //we are checking the box
627 tRTE.innerHTML = lblModeRichText;
628 stripGuidelines(rte);
630 showHideElement("Buttons1_" + rte, "hide", true);
631 if(document.getElementById("Buttons2_"+rte)){
632 showHideElement("Buttons2_" + rte, "hide", true);
633 cRTE.style.height = obj_height+56;
635 cRTE.style.height = obj_height+28;
640 oRTE.body.innerText = hRTE.value;
642 htmlSrc = oRTE.createTextNode(hRTE.value);
643 oRTE.body.innerHTML = "";
644 oRTE.body.appendChild(htmlSrc);
646 iRTE.innerHTML = '<img src="'+imagesPath+'design.gif" alt="Switch Mode" style="margin:1px;" align=absmiddle>';
648 //we are unchecking the box
649 obj_height = parseInt(cRTE.style.height);
650 tRTE.innerHTML = lblModeHTML;
652 showHideElement("Buttons1_" + rte, "show", true);
653 if(document.getElementById("Buttons2_"+rte)){
654 showHideElement("Buttons2_" + rte, "show", true);
655 cRTE.style.height = obj_height-56;
657 cRTE.style.height = obj_height-28;
662 var output = escape(oRTE.body.innerText);
663 output = output.replace("%3CP%3E%0D%0A%3CHR%3E", "%3CHR%3E");
664 output = output.replace("%3CHR%3E%0D%0A%3C/P%3E", "%3CHR%3E");
665 oRTE.body.innerHTML = unescape(output);
666 // Disabled due to flaw in the regular expressions, this fix
667 // does not work with the revamped's enhanced insert link dialog window.
669 // Prevent links from changing to absolute paths
671 var tagfix = unescape(output).match(/<a[^>]*href=(['"])([^\1>]*)\1[^>]*>/ig);
672 var coll = oRTE.body.all.tags('A');
673 for(i=0; i<coll.length; i++){
674 // the 2 alerts below show when we hinder the links from becoming absolute
676 coll[i].href = tagfix[i].replace(/.*href=(['"])([^\1]*)\1.*/i,"$2");
677 //alert(RegExp.$1 + " " + RegExp.$2 + " " + RegExp.$3);
679 var imgfix = unescape(output).match(/<img[^>]*src=['"][^'"]*['"][^>]*>/ig);
680 var coll2 = oRTE.body.all.tags('IMG');
681 for(i=0; i<coll2.length; i++){
682 coll2[i].src = imgfix[i].replace(/.*src=['"]([^'"]*)['"].*/i,"$1");
687 htmlSrc = oRTE.body.ownerDocument.createRange();
688 htmlSrc.selectNodeContents(oRTE.body);
689 oRTE.body.innerHTML = htmlSrc.toString();
691 oRTE.body.innerHTML = replaceSpecialChars(oRTE.body.innerHTML);
693 // (IE Only)This prevents an undo operation from displaying a pervious HTML mode
694 // This resets the undo/redo buffer.
698 iRTE.innerHTML = '<img src="'+imagesPath+'code.gif" alt="Switch Mode" style="margin:1px;" align=absmiddle>';
702 function toggleSelection(rte) {
703 var rng = setRange(rte);
704 var oRTE = returnRTE(rte).document;
708 length1 = rng.text.length;
709 var output = escape(oRTE.body.innerText);
710 output = output.replace("%3CP%3E%0D%0A%3CHR%3E", "%3CHR%3E");
711 output = output.replace("%3CHR%3E%0D%0A%3C/P%3E", "%3CHR%3E");
712 length2 = unescape(output).length;
714 length1 = rng.toString().length;
715 var htmlSrc = oRTE.body.ownerDocument.createRange();
716 htmlSrc.selectNodeContents(oRTE.body);
717 length2 = htmlSrc.toString().length;
719 if(length1 < length2){
720 rteCommand(rte,'selectall','');
723 oRTE.designMode = "off";
724 oRTE.designMode = "on";
726 rteCommand(rte,'unselect','');
731 function dlgColorPalette(rte, command) {
732 //function to display or hide color palettes
734 //get dialog position
735 var oDialog = document.getElementById('cp' + rte);
736 var buttonElement = document.getElementById(command+"_"+rte);
737 var iLeftPos = buttonElement.offsetLeft+5;
738 var iTopPos = buttonElement.offsetTop+53;
739 if (!document.getElementById('Buttons2_'+rte)){
740 iTopPos = iTopPos-28;
742 oDialog.style.left = iLeftPos + "px";
743 oDialog.style.top = iTopPos + "px";
745 if((command == parent.command)&&(rte == currentRTE)){
746 //if current command dialog is currently open, close it
747 if(oDialog.style.visibility == "hidden"){
748 showHideElement(oDialog, 'show', false);
750 showHideElement(oDialog, 'hide', false);
753 //if opening a new dialog, close all others
754 var vRTEs = allRTEs.split(";");
755 for(var i = 0; i<vRTEs.length; i++){
756 showHideElement('cp' + vRTEs[i], 'hide', false);
758 showHideElement(oDialog, 'show', false);
760 //save current values
762 parent.command = command;
765 function dlgLaunch(rte, command) {
766 var selectedText = '';
767 //save current values
768 parent.command = command;
772 InsertChar = popUpWin(includesPath+'insert_char.htm', 'InsertChar', 50, 50, 'status=yes,');
775 InsertTable = popUpWin(includesPath + 'insert_table.htm', 'InsertTable', 50, 50, 'status=yes,');
780 InsertImg = popUpWin(includesPath + 'insert_img.htm','AddImage', 50, 50, 'status=yes,');
783 selectedText = getText(rte);
784 InsertLink = popUpWin(includesPath + 'insert_link.htm', 'InsertLink', 50, 50, 'status=yes,');
785 setFormText("0", selectedText);
788 selectedText = getText(rte);
789 dlgReplace = popUpWin(includesPath + 'replace.htm', 'dlgReplace', 50, 50, 'status=yes,');
790 setFormText("1", selectedText);
793 dlgPasteText = popUpWin(includesPath + 'paste_text.htm', 'dlgPasteText', 50, 50, 'status=yes,');
796 dlgPasteWord = popUpWin(includesPath + 'paste_word.htm', 'dlgPasteWord', 50, 50, 'status=yes,');
801 function getText(rte) {
802 //get currently highlighted text and set link text value
806 rtn = stripHTML(rng.htmlText);
808 rtn = stripHTML(rng.toString());
812 rtn = rtn.replace("'","\\\\\\'");
814 rtn = rtn.replace("'","\\'");
819 function setFormText(popup, content){
820 //set link text value in dialog windows
821 if(content != "undefined")
825 case "0": InsertLink.document.getElementById("linkText").value = content; break;
826 case "1": dlgReplace.document.getElementById("searchText").value = content; break;
829 //may take some time to create dialog window.
830 //Keep looping until able to set.
831 setTimeout("setFormText('"+popup+"','" + content + "');", 10);
836 function dlgCleanUp(){
837 var vRTEs = allRTEs.split(";");
838 for(var i = 0; i < vRTEs.length; i++){
839 showHideElement('cp' + vRTEs[i], 'hide', false);
841 if(InsertChar != null){
845 if(InsertTable != null){
849 if(InsertLink != null){
853 if(InsertImg != null){
857 if(dlgReplace != null){
861 if(dlgPasteText != null){
862 dlgPasteText.close();
865 if(dlgPasteWord != null){
866 dlgPasteWord.close();
871 function popUpWin (url, win, width, height, options) {
873 var leftPos = (screen.availWidth - width) / 2;
874 var topPos = (screen.availHeight - height) / 2;
875 options += 'width=' + width + ',height=' + height + ',left=' + leftPos + ',top=' + topPos;
876 return window.open(url, win, options);
879 function setColor(color) {
880 //function to set color
881 var rte = currentRTE;
882 var parentCommand = parent.command;
884 if(parentCommand == "hilitecolor"){
885 parentCommand = "backcolor";
887 //retrieve selected range
890 rteCommand(rte, parentCommand, color);
891 showHideElement('cp'+rte, "hide", false);
894 function addImage(rte) {
896 //function to add image
897 imagePath = prompt('Enter Image URL:', 'http://');
898 if((imagePath != null)&&(imagePath != "")){
899 rteCommand(rte, 'InsertImage', imagePath);
903 function rtePrint(rte) {
906 document.getElementById(rte).contentWindow.document.execCommand('Print');
908 document.getElementById(rte).contentWindow.print();
912 function selectFont(rte, selectname){
913 //function to handle font changes
914 var idx = document.getElementById(selectname).selectedIndex;
915 // First one is always a label
917 var selected = document.getElementById(selectname).options[idx].value;
918 var cmd = selectname.replace('_'+rte, '');
919 rteCommand(rte, cmd, selected);
920 document.getElementById(selectname).selectedIndex = 0;
924 function insertHTML(html){
925 //function to add HTML -- thanks dannyuk1982
926 var rte = currentRTE;
927 var oRTE = returnRTE(rte);
930 var oRng = oRTE.document.selection.createRange();
931 oRng.pasteHTML(html);
932 oRng.collapse(false);
935 oRTE.document.execCommand('insertHTML', false, html);
939 function replaceHTML(tmpContent, searchFor, replaceWith) {
944 while(tmpContent.toUpperCase().indexOf(searchFor.toUpperCase()) > -1) {
945 runCount = runCount+1;
946 // Get all content before the match
947 intBefore = tmpContent.toUpperCase().indexOf(searchFor.toUpperCase());
948 tmpBefore = tmpContent.substring(0, intBefore);
949 tmpOutput = tmpOutput + tmpBefore;
950 // Get the string to replace
951 tmpOutput = tmpOutput + replaceWith;
952 // Get the rest of the content after the match until
953 // the next match or the end of the content
954 intAfter = tmpContent.length - searchFor.length + 1;
955 tmpContent = tmpContent.substring(intBefore + searchFor.length);
957 return runCount+"|^|"+tmpOutput+tmpContent;
960 function replaceSpecialChars(html){
961 var specials = new Array("¢","€","£","¤","¥","©","®","™","÷","×","±","¼","½","¾","°","¹","²","³","µ","«","»","‘","’","‹","›","‚","„","“","”","¡","¦","§","¬","¯","¶","·","¸","¿","ƒ","—","–","•","…","‰","ª","º","ß","†","‡","ð","Ð","ø","Ø","þ","Þ","œ","Œ","š","Š","´","ˆ","˜","¨","à","á","â","ã","ä","å","æ","À","Á","Â","Ã","Ä","Å","Æ","ç","Ç","è","é","ê","ë","È","É","Ê","Ë","ì","í","î","ï","Ì","Í","Î","Ï","ñ","Ñ","ò","ó","ô","õ","ö","Ò","Ó","Ô","Õ","Ö","ù","ú","û","ü","Ù","Ú","Û","Ü","ý","ÿ","Ý","Ÿ");
962 var unicodes = new Array("\u00a2","\u20ac","\u00a3","\u00a4","\u00a5","\u00a9","\u00ae","\u2122","\u00f7","\u00d7","\u00b1","\u00bc","\u00bd","\u00be","\u00b0","\u00b9","\u00b2","\u00b3","\u00b5","\u00ab","\u00bb","\u2018","\u2019","\u2039","\u203a","\u201a","\u201e","\u201c","\u201d","\u00a1","\u00a6","\u00a7","\u00ac","\u00af","\u00b6","\u00b7","\u00b8","\u00bf","\u0192","\u2014","\u2013","\u2022","\u2026","\u2030","\u00aa","\u00ba","\u00df","\u2020","\u2021","\u00f0","\u00d0","\u00f8","\u00d8","\u00fe","\u00de","\u0153","\u0152","\u0161","\u0160","\u00b4","\u02c6","\u02dc","\u00a8","\u00e0","\u00e1","\u00e2","\u00e3","\u00e4","\u00e5","\u00e6","\u00c0","\u00c1","\u00c2","\u00c3","\u00c4","\u00c5","\u00c6","\u00e7","\u00c7","\u00e8","\u00e9","\u00ea","\u00eb","\u00c8","\u00c9","\u00ca","\u00cb","\u00ec","\u00ed","\u00ee","\u00ef","\u00cc","\u00cd","\u00ce","\u00cf","\u00f1","\u00d1","\u00f2","\u00f3","\u00f4","\u00f5","\u00f6","\u00d2","\u00d3","\u00d4","\u00d5","\u00d6","\u00f9","\u00fa","\u00fb","\u00fc","\u00d9","\u00da","\u00db","\u00dc","\u00fd","\u00ff","\u00dd","\u0178");
963 for(var i=0; i<specials.length; i++){
964 html = replaceIt(html,unicodes[i],specials[i]);
969 function SearchAndReplace(searchFor, replaceWith, matchCase, wholeWord) {
970 var cfrmMsg = lblSearchConfirm.replace("SF",searchFor).replace("RW",replaceWith);
971 var rte = currentRTE;
972 stripGuidelines(rte);
973 var oRTE = returnRTE(rte);
974 var tmpContent = oRTE.document.body.innerHTML.replace("'", "\'").replace('"', '\"');
976 if (matchCase && wholeWord) {
977 strRegex = "/(?!<[^>]*)(\\b(" + searchFor + ")\\b)(?![^<]*>)/g";
979 else if (matchCase) {
980 strRegex = "/(?!<[^>]*)(" + searchFor + ")(?![^<]*>)/g";
982 else if (wholeWord) {
983 strRegex = "/(?!<[^>]*)(\\b(" + searchFor + ")\\b)(?![^<]*>)/gi";
985 strRegex = "/(?!<[^>]*)(" + searchFor + ")(?![^<]*>)/gi";
987 var cmpRegex=eval(strRegex);
989 var tmpNext = tmpContent;
990 var intFound = tmpNext.search(cmpRegex);
991 while(intFound > -1) {
992 runCount = runCount+1;
993 tmpNext = tmpNext.substr(intFound + searchFor.length);
994 intFound = tmpNext.search(cmpRegex);
997 cfrmMsg = cfrmMsg.replace("[RUNCOUNT]",runCount);
998 if(confirm(cfrmMsg)) {
999 tmpContent=tmpContent.replace(cmpRegex,replaceWith);
1000 oRTE.document.body.innerHTML = tmpContent.replace("\'", "'").replace('\"', '"');
1002 alert(lblSearchAbort);
1004 showGuidelines(rte);
1007 showGuidelines(rte);
1008 alert("["+searchFor+"] "+lblSearchNotFound);
1012 function showHideElement(element, showHide, rePosition){
1013 //function to show or hide elements
1014 //element variable can be string or object
1015 if(document.getElementById(element)){
1016 element = document.getElementById(element);
1018 if(showHide == "show"){
1019 element.style.visibility = "visible";
1021 element.style.position = "relative";
1022 element.style.left = "auto";
1023 element.style.top = "auto";
1025 }else if(showHide == "hide"){
1026 element.style.visibility = "hidden";
1028 element.style.position = "absolute";
1029 element.style.left = "-1000px";
1030 element.style.top = "-1000px";
1035 function setRange(rte){
1036 //function to store range of current selection
1037 var oRTE = returnRTE(rte);
1040 selection = oRTE.document.selection;
1041 if(selection != null){
1042 rng = selection.createRange();
1045 selection = oRTE.getSelection();
1046 rng = selection.getRangeAt(selection.rangeCount - 1).cloneRange();
1051 function stripHTML(strU) {
1053 var strN = strU.replace(/(<([^>]+)>)/ig,"");
1054 //replace carriage returns and line feeds
1055 strN = strN.replace(/\r\n/g," ");
1056 strN = strN.replace(/\n/g," ");
1057 strN = strN.replace(/\r/g," ");
1062 function trim(inputString) {
1063 if (typeof inputString != "string"){
1066 inputString = inputString.replace(/^\s+|\s+$/g, "").replace(/\s{2,}/g, "");
1070 function showGuidelines(rte) {
1071 if(rte.length == 0) rte = currentRTE;
1072 var oRTE = returnRTE(rte);
1073 var tables = oRTE.document.getElementsByTagName("table");
1074 var sty = "dashed 1px "+zeroBorder;
1075 for(var i=0; i<tables.length; i++){
1076 if(tables[i].getAttribute("border") == 0){
1078 var trs = tables[i].getElementsByTagName("tr");
1079 for(var j=0; j<trs.length; j++){
1080 var tds = trs[j].getElementsByTagName("td");
1081 for(var k=0; k<tds.length; k++){
1082 if(j == 0 && k == 0){
1083 tds[k].style.border = sty;
1084 }else if(j == 0 && k != 0){
1085 tds[k].style.borderBottom = sty;
1086 tds[k].style.borderTop = sty;
1087 tds[k].style.borderRight = sty;
1088 }else if(j != 0 && k == 0) {
1089 tds[k].style.borderBottom = sty;
1090 tds[k].style.borderLeft = sty;
1091 tds[k].style.borderRight = sty;
1092 }else if(j != 0 && k != 0) {
1093 tds[k].style.borderBottom = sty;
1094 tds[k].style.borderRight = sty;
1099 tables[i].removeAttribute("border");
1100 tables[i].setAttribute("style","border: " + sty);
1101 tables[i].setAttribute("rules", "all");
1107 function stripGuidelines(rte) {
1108 var oRTE = returnRTE(rte);
1109 var tbls = oRTE.document.getElementsByTagName("table");
1110 for(var j=0; j<tbls.length; j++) {
1111 if(tbls[j].getAttribute("border") == 0 || tbls[j].getAttribute("border") == null){
1113 var tds = tbls[j].getElementsByTagName("td");
1114 for(var k=0; k<tds.length; k++) {
1115 tds[k].removeAttribute("style");
1118 tbls[j].removeAttribute("style");
1119 tbls[j].removeAttribute("rules");
1120 tbls[j].setAttribute("border","0");
1126 function findSize(obj) {
1127 if(obj.length > 0 && document.all) {
1129 } else if(obj.length > 0 && !document.all) {
1130 obj = document.getElementById(obj).contentWindow;
1134 if ( typeof( obj.window.innerWidth ) == 'number' ) {
1136 obj_width = obj.window.innerWidth;
1137 obj_height = obj.window.innerHeight;
1138 } else if( obj.document.documentElement && ( obj.document.documentElement.clientWidth || obj.document.documentElement.clientHeight ) ) {
1139 //IE 6+ in 'standards compliant mode'
1140 obj_width = document.documentElement.clientWidth;
1141 obj_height = document.documentElement.clientHeight;
1142 } else if( obj.document.body && ( obj.document.body.clientWidth || obj.document.body.clientHeight ) ) {
1144 obj_width = obj.document.body.clientWidth;
1145 obj_height = obj.document.body.clientHeight;
1149 function resizeRTE() {
1150 document.body.style.overflow = "hidden";
1151 var rte = currentRTE;
1152 var oRTE = document.getElementById(rte);
1153 var oBut1 = document.getElementById('Buttons1_'+rte);
1155 var oVS = document.getElementById('vs'+rte);
1158 if (width < minWidth){
1159 document.body.style.overflow = "auto";
1162 var height = obj_height - 83;
1163 if (document.getElementById("_xtSrc"+rte).innerHTML == lblModeRichText){
1164 height = obj_height-28;
1165 if (!document.getElementById('Buttons2_'+rte) && width < wrapWidth) {
1166 document.body.style.overflow = "auto";
1169 if (document.getElementById('Buttons2_'+rte)){
1170 document.getElementById('Buttons2_'+rte).style.width = width;
1173 if (document.getElementById('Buttons2_'+rte)) {
1174 document.getElementById('Buttons2_'+rte).style.width = width;
1176 height = obj_height - 55;
1177 if(width < wrapWidth){
1178 document.body.style.overflow = "auto";
1183 if(document.body.style.overflow == "auto" && isIE){
1186 if(document.body.style.overflow == "auto" && !isIE){
1189 oBut1.style.width = width;
1190 oVS.style.width = width;
1191 oRTE.style.width = width-2;
1192 oRTE.style.height = height;
1194 oRTE.contentDocument.designMode = "on";
1198 function replaceIt(string,text,by) {
1199 // CM 19/10/04 custom replace function
1200 var strLength = string.length, _xtLength = text.length;
1201 if ((strLength == 0) || (_xtLength == 0)){
1204 var i = string.indexOf(text);
1205 if ((!i) && (text != string.substring(0,_xtLength))){
1211 var newstr = string.substring(0,i) + by;
1212 if(i+_xtLength < strLength){
1213 newstr += replaceIt(string.substring(i+_xtLength,strLength),text,by);
1218 function countWords(rte){
1220 var words = document.getElementById("hdn"+rte).value;
1221 var str = stripHTML(words);
1222 var chars = trim(words);
1223 chars = chars.length;
1224 chars = maxchar - chars;
1225 str = str+" a "; // word added to avoid error
1226 str = trim(str.replace(/ /gi,' ').replace(/([\n\r\t])/g,' ').replace(/&(.*);/g,' '));
1228 for(x=0;x<str.length;x++){
1229 if(str.charAt(x)==" " && str.charAt(x-1)!=" "){
1233 if(str.charAt(str.length-1) != " "){
1236 count = count - 1; // extra word removed
1239 alarm = "\n\n"+lblCountCharWarn;
1241 alert(lblCountTotal+": "+count+ "\n\n"+lblCountChar+": "+chars+alarm);
1244 //********************
1245 // Non-designMode() Functions
1246 //********************
1247 function autoBRon(rte) {
1248 // CM 19/10/04 used for non RTE browsers to deal with auto <BR> (and clean up other muck)
1249 var oRTE = document.forms[0].elements[rte];
1250 oRTE.value=parseBreaks(oRTE.value);
1251 oRTE.value=replaceIt(oRTE.value,''','\'');
1254 function autoBRoff(rte) {
1255 // CM 19/10/04 used for non RTE browsers to deal with auto <BR> (auto carried out when the form is submitted)
1256 var oRTE = document.forms[0].elements[rte];
1257 oRTE.value=replaceIt(oRTE.value,'\n','<br />');
1258 oRTE.value=replaceIt(oRTE.value,'\'',''');
1261 function parseBreaks(argIn) {
1262 // CM 19/10/04 used for non RTE browsers to deal with auto <BR> (and clean up other muck)
1263 argIn=replaceIt(argIn,'<br>','\n');
1264 argIn=replaceIt(argIn,'<BR>','\n');
1265 argIn=replaceIt(argIn,'<br/>','\n');
1266 argIn=replaceIt(argIn,'<br />','\n');
1267 argIn=replaceIt(argIn,'\t',' ');
1268 argIn=replaceIt(argIn,'\n ','\n');
1269 argIn=replaceIt(argIn,' <p>','<p>');
1270 argIn=replaceIt(argIn,'</p><p>','\n\n');
1271 argIn=replaceIt(argIn,''','\'');
1272 argIn = trim(argIn);
1276 //********************
1277 //Gecko-Only Functions
1278 //********************
1279 function geckoKeyPress(evt) {
1280 //function to add bold, italic, and underline shortcut commands to gecko RTEs
1281 //contributed by Anti Veeranna (thanks Anti!)
1282 var rte = evt.target.id;
1284 var key = String.fromCharCode(evt.charCode).toLowerCase();
1287 case 'b': cmd = "bold"; break;
1288 case 'i': cmd = "italic"; break;
1289 case 'u': cmd = "underline"; break;
1292 rteCommand(rte, cmd, null);
1293 // stop the event bubble
1294 evt.preventDefault();
1295 evt.stopPropagation();
1303 function checkspell() {
1305 //function to perform spell check
1307 var tmpis = new ActiveXObject("ieSpell.ieSpellExtension");
1308 tmpis.CheckAllLinkedDocuments(document);
1311 if(exception.number==-2146827859) {
1312 if(confirm("ieSpell not detected. Click Ok to go to download page.")){
1313 window.open("http://www.iespell.com/download.php","DownLoad");
1316 alert("Error Loading ieSpell: Exception " + exception.number);