function WYSIWYG_Editor(F,B,E,G,D,A,C){this.isIE=navigator.userAgent.indexOf("MSIE")>=0;if(typeof (F)=="undefined"){alert("ERROR: No instance name was passed for the editor.");return false}else{this.instance_name=F}this.editor_area=B;this.field_name=F;if(typeof (E)=="undefined"){this.content=""}else{this.content=E}if(typeof (G)=="undefined"){this.wysiwyg_path="."}else{this.wysiwyg_path=G}if(D&&D>0){this.frame_width=D}else{this.frame_width=548}if(A&&A>0){this.frame_height=A}else{this.frame_height=150}this.minimal=C;this.allowsAnchors=false;this.wysiwyg_content=this.instance_name+"_WYSIWYG_Editor";this.wysiwyg_hidden=this.field_name;this.ta_rows=Math.round(this.frame_height/15);this.ta_cols=Math.round(this.frame_width/8);this.viewMode=1;this._X=this._Y=0;this.allow_mode_toggle=false;this.allow_speller=true;this.table_border=1;this.table_cell_padding=3;this.table_cell_spacing=0;this.isSpelling=false;this.isHtml=false;this.rteReady=false;this.wantsFocus=false}WYSIWYG_Editor.prototype.setAllowAnchors=function(A){this.allowsAnchors=A};WYSIWYG_Editor.prototype.setModeToggle=function(A){this.allow_mode_toggle=A};WYSIWYG_Editor.prototype.setSpellCheck=function(A){this.allow_speller=A};WYSIWYG_Editor.prototype.getFrameName=function(){return this.instance_name+"_WYSIWYG_Editor"};WYSIWYG_Editor.prototype.getFrameElement=function(){var A=window.document.getElementById(this.getFrameName());if(A==null){A=document.getElementbyId(this.wysiwyg_hidden)}return A};WYSIWYG_Editor.prototype.inHtmlMode=function(){return(this.viewMode==2)};WYSIWYG_Editor.prototype.getContentWindow=function(){var A=document.getElementById(this.wysiwyg_content);if(A==null){return null}else{return A.contentWindow}};WYSIWYG_Editor.prototype.getContent=function(){if(this.isSpelling){this.checkSpelling()}if(this.isHtml){this.toggleMode()}var A=this.getContentData();A=A.replace(/\n/g," ");A=this.replaceLinks(A);if(A.match(/^ *<br> *$/i)){A=""}return A};WYSIWYG_Editor.prototype.replaceLinks=function(A){if(!this.allowsAnchors){A=A.replace(/<A HREF=['"]HTTP:\/\/(.*?)['"]>(.*?)<\/A>/ig,"$2 ($1)");A=A.replace(/<A HREF=['"](.*?)['"]>(.*?)<\/A>/ig,"$2 ($1)");A=A.replace(/(.*?) \(\1\)/ig,"$1")}return A};WYSIWYG_Editor.prototype.getContentData=function(){var A=this.getContentWindow();if(A==null){return document.getElementById(this.wysiwyg_hidden).value}else{return A.document.body.innerHTML}};WYSIWYG_Editor.prototype.setContent=function(A){var B=this.getContentWindow();if(B==null){document.getElementById(this.wysiwyg_hidden).value=A}else{B.document.body.innerHTML=A}};function autoURLInsert(A){var C=A.keyCode?A.keyCode:A.which?A.which:A.charCode;if(C==34){var B=document.getElementById(this.wysiwyg_content).contentWindow.document.body.innerHTML;alert(B)}}WYSIWYG_Editor.prototype.applySetupQuirk=function(){var A=this.getContentWindow().document;A.body.style.fontSize="16px"};WYSIWYG_Editor.prototype.checkPaste=function(A){var B=YAHOO.util.Event.getCharCode(A);setTimeout(delegateCallback(this,this.preparePasteText),800)};WYSIWYG_Editor.prototype.doPaste=function(){this.doTextFormat("paste","");this.preparePasteText()};WYSIWYG_Editor.prototype.preparePasteText=function(){var A=this.getContent();var B=false;if(this.isIE){B=A.match(/schemas-microsoft-com:office:office/i)}else{B=A.match(/<meta name="ProgId" content="Word.Document">/i)}A=A.replace(/<BR>/ig,"-BREAK-");A=A.replace(/<style>.*?<\/style>/ig,"");if(B){A=A.replace(/<o:p>&nbsp;<\/o:p>/g,"-BREAK-&nbsp;-BREAK-");A=A.replace(/<w:.*?>.*?<\/w:.*?>/ig,"")}else{A=A.replace(/<\/P>/ig,"-BREAK-")}A=A.replace(/<SPAN .*?font-weight: ?bold.*?>(.*?)<\/SPAN>/ig,"-B-$1-B-");A=A.replace(/<SPAN .*?font-style: ?italic.*?>(.*?)<\/SPAN>/ig,"-I-$1-I-");A=A.replace(/<I>(.*?)<\/I>/ig,"-I-$1-I-");A=A.replace(/<EM>(.*?)<\/EM>/ig,"-I-$1-I-");A=A.replace(/<STRONG>(.*?)<\/STRONG>/ig,"-B-$1-B-");A=A.replace(/<B>(.*?)<\/B>/ig,"-B-$1-B-");A=A.replace(/<LI>(.*?)<\/LI>/ig,"-LI-$1-LI-");A=A.replace(/<UL>(.*?)<\/UL>/ig,"-UL-$1-UL-");A=A.replace(/<OL>(.*?)<\/OL>/ig,"-OL-$1-OL-");A=A.replace(/<SUP>(.*?)<\/SUP>/ig,"-SUP-$1-SUP-");A=A.replace(/<A HREF=['"](.*?)['"]>(.*?)<\/A>/ig,"-A-$1-$2-A-");A=A.replace(/<\/?.*?>/g," ");A=A.replace(/-B-(.*?)-B-/g,"<B>$1</B>");A=A.replace(/-I-(.*?)-I-/g,"<I>$1</I>");A=A.replace(/-LI-(.*?)-LI-/g,"<LI>$1</LI>");A=A.replace(/-UL-(.*?)-UL-/g,"<UL>$1</UL>");A=A.replace(/-OL-(.*?)-OL-/g,"<OL>$1</OL>");A=A.replace(/-SUP-(.*?)-SUP-/g,"<SUP>$1</SUP>");A=A.replace(/-A-(.*?)-(.*?)-A-/g,"<A HREF='$1'>$2</A>");A=A.replace(/-BREAK-/g,"<BR>");A=A.replace(/<BR>\s*<BR>/ig,"<BR>");A=A.replace(/<BR>&nbsp;<BR>\s*$/ig,"");A=A.replace(/<BR>\s*$/ig,"");A=A.replace(/\n/g," ");this.setContent(A)};WYSIWYG_Editor.prototype.autoExpand=function(){var A=document.getElementById(this.wysiwyg_content);var B;if(this.isIE){B=A.contentWindow.document.body.scrollHeight}else{if(webBrowser.isSafari){B=A.contentWindow.document.body.scrollHeight}else{B=A.contentWindow.document.documentElement.clientHeight+20}}if(B>60&&(B-this.frame_height)>5){if(B>400){B=400}A.style.height=B+"px";this.frame_height=B}};WYSIWYG_Editor.prototype.display=function(){if(this.isSupported()){this._display_editor();var B=this.getContentWindow().document;B.open();B.write('<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head>');B.write('<body onload="document.body.rteLoaded = true;">');B.write(this.content);B.write("</body></html>");B.close();this.applySetupQuirk();if(this.isIE){B.onkeypress=rteKeyPress;window.wysiwyg_content=this.wysiwyg_content}var A=this;setTimeout(function(){YAHOO.util.Event.addListener(B,"keypress",A.autoExpand,A,true);YAHOO.util.Event.addListener(B.body,"paste",A.checkPaste,A,true);A.focus()},500)}else{this._display_textarea();this.content=this.content.replace(/<BR>/ig,"\n");this._load_content()}this.autoExpand();this.recount=0;this.activateDesignMode()};WYSIWYG_Editor.prototype.activateDesignMode=function(){var A=this.getContentWindow();if(A.document.body.rteLoaded){this.rteReady=true;A.document.designMode="On";if(this.wantsFocus){this.focusNow()}}else{this.recount++;if(this.recount>200){alert("Can't load RTE")}else{setTimeout(delegateCallback(this,this.activateDesignMode),50)}}};WYSIWYG_Editor.prototype.focus=function(){if(this.rteReady){this.focusNow()}else{this.wantsFocus=true}};WYSIWYG_Editor.prototype.focusNow=function(){var A=this;setTimeout(function(){var B=A.getContentWindow();window.focus();B.focus()},100)};function rteKeyPress(){var B=document.getElementById(window.wysiwyg_content).contentWindow;if(B.event.keyCode==13){var A=B.document.selection.createRange();B.event.returnValue=false;A.pasteHTML("<br>");A.select()}}WYSIWYG_Editor.prototype._display_textarea=function(){var A="";A+='<input type="hidden" name="editorMode" value="textarea">';A+='<textarea name="'+this.wysiwyg_hidden+'" id="'+this.wysiwyg_hidden+'" rows="'+this.ta_rows+'" cols="'+this.ta_cols+'"></textarea><br>';A+='<div style="font-size:10; padding: 3px;">(WARNING: Your browser does not support the Rich Text Editor.  Please use Firefox or Internet Explorer to edit text style and insert images.)</div>';this.editor_area.innerHTML=A};WYSIWYG_Editor.prototype._display_editor=function(){var A="";A+='<input type="hidden" name="editorMode" value="rte">';A+='   <table cellpadding="0" cellspacing="0" id="'+this.instance_name+'_table" class="editorArea">';A+="    <tr>";A+="     <td>";if(!this.minimal){A+='      <table onselectstart="return false" style="-moz-user-select:none" width="100%" border="0" cellspacing="0" cellpadding="0">';A+='       <tr valign="top">';A+='        <td height="25" valign="middle" colspan="2" id="'+this.instance_name+'_spellbar" style="display:none">';A+='        <table cellspacing="0" cellpadding="0" style="padding-left:20px"><tr><td>';A+='            Spelling Mistakes: <span id="mistakeCount"></span>';A+="        </td></tr></table>";A+="        </td>";A+='        <td valign="top" colspan="2" id="'+this.instance_name+'_toolbars"><nobr>';A+='          <img alt="Bold" title="Bold" class="editorButton imgbold" src="http://ui.geckogo.com/ui/media/spacer.gif" onClick="'+this.instance_name+".doTextFormat('bold','')\">";A+='          <img alt="Italic" title="Italic" class="editorButton imgitalic" src="http://ui.geckogo.com/ui/media/spacer.gif" onClick="'+this.instance_name+".doTextFormat('italic','')\">";A+='         <img class="editorSeparator" alt="| imgseparator" src="http://ui.geckogo.com/ui/media/spacer.gif">';A+='          <img alt="Ordered List" title="Ordered List" class="editorButton imgordlist" src="http://ui.geckogo.com/ui/media/spacer.gif"  onClick="'+this.instance_name+".doTextFormat('insertorderedlist','')\">";A+='          <img alt="Bulleted List" title="Bulleted List" class="editorButton imgbullist" src="http://ui.geckogo.com/ui/media/spacer.gif" onClick="'+this.instance_name+".doTextFormat('insertunorderedlist','')\">";A+='          <img alt="Indent" title="Indent imgindent" src="http://ui.geckogo.com/ui/media/spacer.gif" class=editorButton onClick="'+this.instance_name+".doTextFormat('indent','')\">";A+='          <img alt="Outdent" title="Outdent imgoutdent" src="http://ui.geckogo.com/ui/media/spacer.gif" class=editorButton onClick="'+this.instance_name+".doTextFormat('outdent','')\">";A+='         <img class="editorSeparator" alt="| imgseparator" src="http://ui.geckogo.com/ui/media/spacer.gif">';if(this.allowsAnchors){A+='          <img alt="Hyperlink" title="Hyperlink" class="editorButton imglink" src="http://ui.geckogo.com/ui/media/spacer.gif" onClick="'+this.instance_name+".doTextFormat('createlink','')\">"}A+='          <img alt="Remove Formatting" title="Remove Formatting" class="editorButton imgunformat" src="http://ui.geckogo.com/ui/media/spacer.gif" onClick="'+this.instance_name+".doTextFormat('removeformat','')\">";A+='         <img class="editorSeparator" alt="| imgseparator" src="http://ui.geckogo.com/ui/media/spacer.gif">';A+='          <img alt="Undo" title="Undo" class="editorButton imgundo" src="http://ui.geckogo.com/ui/media/spacer.gif" onClick="'+this.instance_name+".doTextFormat('undo','')\">";A+='          <img alt="Redo" title="Redo" class="editorButton imgredo" src="http://ui.geckogo.com/ui/media/spacer.gif" onClick="'+this.instance_name+".doTextFormat('redo','')\">";A+="        </nobr></td>";A+='<td id="'+this.instance_name+'_extra_controls" align="right">';if(this.allow_mode_toggle){A+='          <img id="htmlMode" alt="Toggle Mode" title="Toggle Mode" class="editorButton" src="http://ui.geckogo.com/ui/editor/images/editor-html.png" onClick="'+this.instance_name+'.toggleMode()">'}A+='<img id="checkSpelling" alt="Check Spelling" onclick="'+this.instance_name+'.checkSpelling()" class="editorButton imgeditor-spelling" src="http://ui.geckogo.com/ui/media/spacer.gif" </td>';A+='<td id="'+this.instance_name+'_extra_controls_spelling" style="display:none" align="right">';A+='Click to resume editing: <img id="checkSpelling" alt="Check Spelling" onclick="'+this.instance_name+'.checkSpelling()" class="editorButton imgeditor-spelling" src="http://ui.geckogo.com/ui/media/spacer.gif" </td>';if(this.allow_mode_toggle){A+='<td id="'+this.instance_name+'_extra_controls_mode" align="right" style="display:none">';A+='Click to return to normal view: <img id="htmlMode" alt="Toggle Mode" title="Toggle Mode" class="editorButton imgeditor-html" src="http://ui.geckogo.com/ui/media/spacer.gif" onClick="'+this.instance_name+'.toggleMode()">'}A+="     </tr></table>";A+='       <div id="matchList" style="position:absolute; display:none; background-color:#fff; padding: 5px; border: solid 1px #000; z-index:1000"></div>'}A+='      <iframe id="'+this.wysiwyg_content+'" name="'+this.wysiwyg_content+'" class="editorFrame" style="width:'+this.frame_width+"px; height:"+this.frame_height+'px;" frameborder="0"></iframe>';A+="     </td>";A+="    </tr>";A+="   </table>";this.editor_area.innerHTML=A};WYSIWYG_Editor.prototype.doTextFormat=function(D,A,E){if((D=="forecolor")||(D=="hilitecolor")){this.getPalette(D,A,E)}else{if(D=="createlink"){var C=prompt("Enter a URL:","");if(document.getElementById(this.wysiwyg_content).contentWindow.document.queryCommandEnabled(D)){document.getElementById(this.wysiwyg_content).contentWindow.document.execCommand("CreateLink",false,C);this.getContentWindow().focus();return true}else{return false}}else{if(D=="removeformat"){var B=this.getContentData();B=B.replace(/<\/p>/gi,"<br>");B=B.replace(/<br>/gi,"\n");B=B.replace(/<p .*?>/gi,"");B=B.replace(/<\/?.+?>/gi,"");B=B.replace(/\n/gi,"<br>");this.setContent(B)}if(document.getElementById(this.wysiwyg_content).contentWindow.document.queryCommandEnabled(D)){document.getElementById(this.wysiwyg_content).contentWindow.document.execCommand(D,false,A);this.getContentWindow().focus();return true}else{return false}}}};WYSIWYG_Editor.prototype._load_content=function(){document.getElementById(this.wysiwyg_hidden).value=this.content};WYSIWYG_Editor.prototype.toggleMode=function(){if(this.isMSIE()){this._toggle_mode_ie()}else{this._toggle_mode_gecko()}this.isHtml=!this.isHtml;var A=document.getElementById(this.instance_name+"_toolbars");if(A){if(this.isHtml){A.style.display="none";document.getElementById(this.instance_name+"_extra_controls").style.display="none";document.getElementById(this.instance_name+"_extra_controls_mode").style.display=""}else{A.style.display="";document.getElementById(this.instance_name+"_extra_controls").style.display="";document.getElementById(this.instance_name+"_extra_controls_mode").style.display="none"}}};WYSIWYG_Editor.prototype._toggle_mode_ie=function(){if(this.viewMode==2){document.getElementById(this.wysiwyg_content).contentWindow.document.body.innerHTML=document.getElementById(this.wysiwyg_content).contentWindow.document.body.innerText;document.getElementById(this.wysiwyg_content).contentWindow.document.body.style.fontFamily="";document.getElementById(this.wysiwyg_content).contentWindow.document.body.style.fontSize="";document.getElementById(this.instance_name+"_toolbars").style.display="";document.getElementById(this.wysiwyg_content).contentWindow.focus();this.applySetupQuirk();this.viewMode=1}else{document.getElementById(this.wysiwyg_content).contentWindow.document.body.innerText=document.getElementById(this.wysiwyg_content).contentWindow.document.body.innerHTML;document.getElementById(this.wysiwyg_content).contentWindow.document.body.style.fontFamily="monospace";document.getElementById(this.wysiwyg_content).contentWindow.document.body.style.fontSize="10pt";document.getElementById(this.wysiwyg_content).contentWindow.focus();this.viewMode=2}};WYSIWYG_Editor.prototype._toggle_mode_gecko=function(){if(this.viewMode==2){var A=document.getElementById(this.wysiwyg_content).contentWindow.document.body.ownerDocument.createRange();A.selectNodeContents(document.getElementById(this.wysiwyg_content).contentWindow.document.body);document.getElementById(this.wysiwyg_content).contentWindow.document.body.innerHTML=A.toString();document.getElementById(this.wysiwyg_content).contentWindow.document.body.style.fontFamily="";document.getElementById(this.wysiwyg_content).contentWindow.document.body.style.fontSize="";document.getElementById(this.instance_name+"_toolbars").style.display="";document.getElementById(this.wysiwyg_content).contentWindow.focus();this.viewMode=1}else{var A=document.createTextNode(document.getElementById(this.wysiwyg_content).contentWindow.document.body.innerHTML);document.getElementById(this.wysiwyg_content).contentWindow.document.body.innerHTML="";document.getElementById(this.wysiwyg_content).contentWindow.document.body.appendChild(A);document.getElementById(this.wysiwyg_content).contentWindow.document.body.style.fontFamily="monospace";document.getElementById(this.wysiwyg_content).contentWindow.document.body.style.fontSize="10pt";document.getElementById(this.wysiwyg_content).contentWindow.focus();this.viewMode=2}};WYSIWYG_Editor.prototype.insertTable=function(){colstext=prompt("Enter the number of columns per row.");rowstext=prompt("Enter the number of rows to create.");rows=parseInt(rowstext,"0");cols=parseInt(colstext,"0");if(this.isMSIE()){return this._insert_table_ie(cols,rows)}else{return this._insert_table_gecko(cols,rows)}};WYSIWYG_Editor.prototype._insert_table_ie=function(D,B){document.getElementById(this.wysiwyg_content).contentWindow.focus();var E=document.getElementById(this.wysiwyg_content).contentWindow.document.selection.createRange();if((B>0)&&(D>0)){var A='<table border="'+this.table_border+'" cellpadding="'+this.table_cell_padding+'" cellspacing="'+this.table_cell_spacing+'">';while(B>0){B--;var C=D;A=A+"<tr>";while(parseInt(C)>0){C--;A=A+"<td>&nbsp;</td>"}A=A+"</tr>"}A=A+"</table>";E.pasteHTML(A);document.getElementById(this.wysiwyg_content).contentWindow.focus()}return true};WYSIWYG_Editor.prototype._insert_table_gecko=function(B,A){contentWin=document.getElementById(this.wysiwyg_content).contentWindow;if((A>0)&&(B>0)){table=contentWin.document.createElement("table");table.setAttribute("border",this.table_border);table.setAttribute("cellpadding",this.table_cell_padding);table.setAttribute("cellspacing",this.table_cell_spacing);tbody=contentWin.document.createElement("tbody");for(i=0;i<A;i++){tr=contentWin.document.createElement("tr");for(j=0;j<B;j++){td=contentWin.document.createElement("td");br=contentWin.document.createElement("br");td.appendChild(br);tr.appendChild(td)}tbody.appendChild(tr)}table.appendChild(tbody);this._insert_element_gecko(contentWin,table)}return true};WYSIWYG_Editor.prototype._insert_element_gecko=function(G,D){var B=G.getSelection();var F=B.getRangeAt(0);B.removeAllRanges();F.deleteContents();var A=F.startContainer;var K=F.startOffset;F=document.createRange();if(A.nodeType==3&&D.nodeType==3){A.insertData(K,D.nodeValue);F.setEnd(A,K+D.length);F.setStart(A,K+D.length)}else{var C;if(A.nodeType==3){var E=A;A=E.parentNode;var L=E.nodeValue;var I=L.substr(0,K);var H=L.substr(K);var J=document.createTextNode(I);var C=document.createTextNode(H);A.insertBefore(C,E);A.insertBefore(D,C);A.insertBefore(J,D);A.removeChild(E)}else{C=A.childNodes[K];A.insertBefore(D,C)}}};WYSIWYG_Editor.prototype.setColor=function(A,C){if(typeof (pwin)=="object"){if(!pwin.closed){pwin.close()}}if(this.isMSIE()&&C=="hilitecolor"){C="backcolor"}var B=document.getElementById(this.wysiwyg_content).contentWindow.document.selection;if(B!=null){rng=B.createRange()}document.getElementById(this.wysiwyg_content).contentWindow.focus();if(document.getElementById(this.wysiwyg_content).contentWindow.document.queryCommandEnabled(C)){document.getElementById(this.wysiwyg_content).contentWindow.document.execCommand(C,false,A)}else{return false}document.getElementById(this.wysiwyg_content).contentWindow.focus();return true};WYSIWYG_Editor.prototype.getPalette=function(B,A,C){html=this._get_palette_html(B);if(typeof (pwin)=="object"){if(!pwin.closed){pwin.close()}}pwin=window.open("","colorPalette","dependent=yes, directories=no, fullscreen=no,hotkeys=no,height=125,width=192,left="+C.screenX+",top="+C.screenY+",locatoin=no,menubar=no,resizable=no,scrollbars=no,status=no,titlebar=no,toolbar=no");pwin.document.write(html);pwin.document.close();pwin.focus()};WYSIWYG_Editor.prototype.isSupported=function(){return true};WYSIWYG_Editor.prototype.isMSIE=function(){return this.isIE};WYSIWYG_Editor.prototype._get_palette_html=function(D){s='<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">';s=s+"<html>";s=s+" <head>";s=s+'  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">';s=s+"  <title>Color Palette</title>";s=s+'  <style type="text/css">';s=s+"   <!--";s=s+"    html,body{margin: 0px; padding: 0px; color: black; background-color: white;}";s=s+"    td{border: black solid 1px;}";s=s+"    td:hover{border: white solid 1px;}";s=s+"   -->";s=s+"  </style>";s=s+" </head>";s=s+"";s=s+" <body>";s=s+'  <table border="0" cellpadding="0" cellspacing="2">';for(var C=0;C<7;C++){s=s+"   <tr>";for(var A=0;A<10;A++){var B=colors[C*10+A];s=s+'    <td id="c'+B+'" bgcolor="#'+B+'" width="15" height="15" onclick="str=this.id;color=str.replace(\'c\',\'#\');opener.'+this.instance_name+".setColor(color,'"+D+"');window.close();\"></td>"}}s=s+"  </table>";s=s+" </body>";s=s+"</html>";return s};var colors=new Array("FFFFFF","FFCCCC","FFCC99","FFFF99","FFFFCC","99FF99","99FFFF","CCFFFF","CCCCFF","FFCCFF","CCCCCC","FF6666","FF9966","FFFF66","FFFF33","66FF99","33FFFF","66FFFF","9999FF","FF99FF","C0C0C0","FF0000","FF9900","FFCC66","FFFF00","33FF33","66CCCC","33CCFF","6666CC","CC66CC","999999","CC0000","FF6600","FFCC33","FFCC00","33CC00","00CCCC","3366FF","6633FF","CC33CC","666666","990000","CC6600","CC9933","999900","009900","339999","3333FF","6600CC","993399","333333","660000","993300","996633","666600","006600","336666","000099","333399","663366","000000","330000","663300","663333","333300","003300","003333","000066","330099","330033");WYSIWYG_Editor.prototype.setMediaSelectHandler=function(A){this.mediaSelectHandler=A};WYSIWYG_Editor.prototype.setActivitySelectHandler=function(A){this.activitySelectHandler=A};WYSIWYG_Editor.prototype.insertMedia=function(){this.mediaSelectHandler();var A=document.getElementById(this.wysiwyg_content).contentWindow.document.selection;if(A!=null){rng=A.createRange()}};WYSIWYG_Editor.prototype.insertActivity=function(){this.activitySelectHandler();var A=document.getElementById(this.wysiwyg_content).contentWindow.document.selection;if(A!=null){rng=A.createRange()}};WYSIWYG_Editor.prototype.addMedia=function(B,C){var A=document.getElementById(this.wysiwyg_content).contentWindow;A.focus();if(this.viewMode==1){A.document.execCommand("insertimage",false,B)}};WYSIWYG_Editor.prototype.selectText=function(F){var E=document.getElementById(this.wysiwyg_content);var C=E.contentWindow;C.focus();if(C.document.selection!=null){var A=C.document.selection.createRange();if(A.text==""){A.text=activityName;A=C.document.body.createTextRange();A.findText(activityName);A.select()}}else{var D=C.getSelection();var B=D.getRangeAt(D.rangeCount-1);if(B==""){B.selectNode(C.document.body);D.addRange(B)}}};WYSIWYG_Editor.prototype.addActivity=function(A,H){var G=document.getElementById(this.wysiwyg_content);var D=G.contentWindow;D.focus();if(D.document.selection!=null){var B=D.document.selection.createRange();if(B.text==""){B.text=H;B=D.document.body.createTextRange();B.findText(H);B.select()}}else{var F=D.getSelection();var C=F.getRangeAt(F.rangeCount-1);if(C==""){C=C.cloneRange();var E=G.contentDocument.createTextNode(H);C.insertNode(E);C.selectNode(E);F.addRange(C)}}if(this.viewMode==1){D.document.execCommand("CreateLink",false,A)}if(D.document.selection!=null){var B=D.document.body.createTextRange();B.collapse(false);B.select()}else{var F=D.getSelection();F.collapseToEnd()}};WYSIWYG_Editor.prototype.insertHTML=function(G){var F=document.getElementById(this.wysiwyg_content);var C=F.contentWindow;C.focus();if(C.document.selection!=null){var A=C.document.selection.createRange();if(A.text==""){A.text="MAGIC_MARKER"}}else{var E=C.getSelection();var B=E.getRangeAt(E.rangeCount-1);if(B==""){B=B.cloneRange();var D=F.contentDocument.createTextNode("MAGIC_MARKER");B.insertNode(D);B.selectNode(D);E.addRange(B)}}if(C.document.selection!=null){var A=C.document.selection.createRange();A.collapse(false);body=C.document.body}else{var E=C.getSelection();E.collapseToEnd();body=F.contentDocument.body}body.innerHTML=body.innerHTML.replace(/MAGIC_MARKER/,G)};WYSIWYG_Editor.prototype.checkSpelling=function(){if(window.openSpellingCheck){this.isSpelling=!this.isSpelling;this.renderSpellMode();if(this.isSpelling){window.openSpellingCheck(this)}else{window.closeSpellingCheck(this)}}};WYSIWYG_Editor.prototype.renderSpellMode=function(){var A=document.getElementById(this.instance_name+"_toolbars");if(A){var B=document.getElementById(this.instance_name+"_spellbar");if(this.isSpelling){A.style.display="none";B.style.display="";document.getElementById(this.instance_name+"_extra_controls").style.display="none";document.getElementById(this.instance_name+"_extra_controls_spelling").style.display=""}else{A.style.display="";B.style.display="none";document.getElementById(this.instance_name+"_extra_controls").style.display="";document.getElementById(this.instance_name+"_extra_controls_spelling").style.display="none";this.getContentWindow().focus()}}};WYSIWYG_Editor.prototype.setMistakes=function(A,B){document.getElementById("mistakeCount").innerHTML=B};
