imagesDir="/include/editor/icons/";cssDir="/include/editor/styles/";popupsDir="/include/editor/popups/";wysiwygWidth=400;wysiwygHeight=400;var Fonts=new Array();Fonts[0]="Arial";Fonts[1]="Sans Serif";Fonts[2]="Tahoma";Fonts[3]="Verdana";Fonts[4]="Courier New";Fonts[5]="Georgia";Fonts[6]="Times New Roman";Fonts[7]="Impact";Fonts[8]="Comic Sans MS";var BlockFormats=new Array();BlockFormats[0]="Address";BlockFormats[1]="Bulleted List";BlockFormats[2]="Definition";BlockFormats[3]="Definition Term";BlockFormats[4]="Directory List";BlockFormats[5]="Formatted";BlockFormats[6]="Heading 1";BlockFormats[7]="Heading 2";BlockFormats[8]="Heading 3";BlockFormats[9]="Heading 4";BlockFormats[10]="Heading 5";BlockFormats[11]="Heading 6";BlockFormats[12]="Menu List";BlockFormats[13]="Normal";BlockFormats[14]="Numbered List";var FontSizes=new Array();FontSizes[0]="1";FontSizes[1]="2";FontSizes[2]="3";FontSizes[3]="4";FontSizes[4]="5";FontSizes[5]="6";FontSizes[6]="7";var buttonName=new Array();buttonName[0]="bold";buttonName[1]="italic";buttonName[2]="underline";buttonName[3]="strikethrough";buttonName[5]="subscript";buttonName[6]="superscript";buttonName[8]="justifyleft";buttonName[9]="justifycenter";buttonName[10]="justifyright";buttonName[12]="unorderedlist";buttonName[13]="orderedlist";var buttonName2=new Array();buttonName2[0]="forecolor";buttonName2[1]="backcolor";buttonName2[2]="seperator";buttonName2[3]="cut";buttonName2[4]="copy";buttonName2[5]="paste";buttonName2[6]="seperator";buttonName2[7]="undo";buttonName2[8]="redo";buttonName2[9]="seperator";buttonName2[10]="inserttable";buttonName2[11]="insertimage";buttonName2[12]="createlink";buttonName2[13]="seperator";buttonName2[14]="viewSource";buttonName2[15]="seperator";var ToolbarList={bold:["Bold","Bold",imagesDir+"bold.gif",imagesDir+"bold_on.gif"],italic:["Italic","Italic",imagesDir+"italics.gif",imagesDir+"italics_on.gif"],underline:["Underline","Underline",imagesDir+"underline.gif",imagesDir+"underline_on.gif"],strikethrough:["Strikethrough","Strikethrough",imagesDir+"strikethrough.gif",imagesDir+"strikethrough_on.gif"],seperator:["","",imagesDir+"seperator.gif",imagesDir+"seperator.gif"],subscript:["Subscript","Subscript",imagesDir+"subscript.gif",imagesDir+"subscript_on.gif"],superscript:["Superscript","Superscript",imagesDir+"superscript.gif",imagesDir+"superscript_on.gif"],justifyleft:["Justifyleft","Justifyleft",imagesDir+"justify_left.gif",imagesDir+"justify_left_on.gif"],justifycenter:["Justifycenter","Justifycenter",imagesDir+"justify_center.gif",imagesDir+"justify_center_on.gif"],justifyright:["Justifyright","Justifyright",imagesDir+"justify_right.gif",imagesDir+"justify_right_on.gif"],unorderedlist:["InsertUnorderedList","InsertUnorderedList",imagesDir+"list_unordered.gif",imagesDir+"list_unordered_on.gif"],orderedlist:["InsertOrderedList","InsertOrderedList",imagesDir+"list_ordered.gif",imagesDir+"list_ordered_on.gif"],outdent:["Outdent","Outdent",imagesDir+"indent_left.gif",imagesDir+"indent_left_on.gif"],indent:["Indent","Indent",imagesDir+"indent_right.gif",imagesDir+"indent_right_on.gif"],cut:["Cut","Cut",imagesDir+"cut.gif",imagesDir+"cut_on.gif"],copy:["Copy","Copy",imagesDir+"copy.gif",imagesDir+"copy_on.gif"],paste:["Paste","Paste",imagesDir+"paste.gif",imagesDir+"paste_on.gif"],forecolor:["ForeColor","ForeColor",imagesDir+"forecolor.gif",imagesDir+"forecolor_on.gif"],backcolor:["BackColor","BackColor",imagesDir+"backcolor.gif",imagesDir+"backcolor_on.gif"],undo:["Undo","Undo",imagesDir+"undo.gif",imagesDir+"undo_on.gif"],redo:["Redo","Redo",imagesDir+"redo.gif",imagesDir+"redo_on.gif"],inserttable:["InsertTable","InsertTable",imagesDir+"insert_table.gif",imagesDir+"insert_table_on.gif"],insertimage:["InsertImage","InsertImage",imagesDir+"insert_picture.gif",imagesDir+"insert_picture_on.gif"],createlink:["CreateLink","CreateLink",imagesDir+"insert_hyperlink.gif",imagesDir+"insert_hyperlink_on.gif"],viewSource:["ViewSource","ViewSource",imagesDir+"view_source.gif",imagesDir+"view_source_on.gif"],viewText:["ViewText","ViewText",imagesDir+"view_text.gif",imagesDir+"view_text_on.gif"],help:["Help","Help",imagesDir+"help.gif",imagesDir+"help_on.gif"],selectfont:["SelectFont","SelectFont",imagesDir+"select_font.gif",imagesDir+"select_font_on.gif"],selectsize:["SelectSize","SelectSize",imagesDir+"select_size.gif",imagesDir+"select_size_on.gif"]};if(typeof HTMLElement!="undefined"&&!HTMLElement.prototype.insertAdjacentElement){HTMLElement.prototype.insertAdjacentElement=function(A,B){switch(A){case"beforeBegin":this.parentNode.insertBefore(B,this);break;case"afterBegin":this.insertBefore(B,this.firstChild);break;case"beforeEnd":this.appendChild(B);break;case"afterEnd":if(this.nextSibling){this.parentNode.insertBefore(B,this.nextSibling)}else{this.parentNode.appendChild(B)}break}};HTMLElement.prototype.insertAdjacentHTML=function(B,D){var C=this.ownerDocument.createRange();C.setStartBefore(this);var A=C.createContextualFragment(D);this.insertAdjacentElement(B,A)};HTMLElement.prototype.insertAdjacentText=function(B,C){var A=document.createTextNode(C);this.insertAdjacentElement(B,A)}}viewTextMode=0;function generate_wysiwyg(A){document.getElementById(A).style.display="none";var C=A;toolbarWidth=parseFloat(wysiwygWidth)+2;var M;M='<table border="0" class="toolbar1" style="width:'+toolbarWidth+'px;"><tr><td style="width: 4px;"><img src="'+imagesDir+'seperator2.gif" alt="" hspace="0"></td>';M+='<td style="width: 90px;"><span id="FontSelect'+C+'"></span></td>';M+='<td style="width: 60px;"><span id="FontSizes'+C+'"></span></td>';for(var H=0;H<=buttonName.length;){if(buttonName[H]){var B=ToolbarList[buttonName[H]];var Q=B[0];var G=B[1];var P=B[2];var I=B[3];if(buttonName[H]=="seperator"){M+='<td style="width: 12px;" align="center"><img src="'+P+'" border=0 unselectable="on" width="2" height="18" hspace="0" unselectable="on"></td>'}else{M+='<td style="width: 22px;"><img src="'+P+'" border=0 unselectable="on" title="'+G+'" id="'+Q+'" class="button" onClick="formatText(this.id,\''+C+"');\" onmouseover=\"if(className=='button'){className='buttonOver'}; this.src='"+I+"';\" onmouseout=\"if(className=='buttonOver'){className='button'}; this.src='"+P+'\';" unselectable="on" width="20" height="20"></td>'}}H++}M+="<td>&nbsp;</td></tr></table>";var L;L='<table cellpadding="0" cellspacing="0" border="0" class="toolbar2" style="width:'+toolbarWidth+'px;"><tr><td style="width: 4px;"><img src="'+imagesDir+'seperator2.gif" alt="" hspace="0"></td>';for(var F=0;F<=buttonName2.length;){if(buttonName2[F]){var B=ToolbarList[buttonName2[F]];var Q=B[0];var G=B[1];var P=B[2];var I=B[3];if(buttonName2[F]=="seperator"){L+='<td style="width: 12px;" align="center"><img src="'+P+'" border=0 unselectable="on" width="2" height="18" hspace="0" unselectable="on"></td>'}else{if(buttonName2[F]=="viewSource"){L+='<td style="width: 22px;">';L+='<span id="HTMLMode'+C+'"><img src="'+P+'" border=0 unselectable="on" title="'+G+'" id="'+Q+'" class="button" onClick="formatText(this.id,\''+C+"');\" onmouseover=\"if(className=='button'){className='buttonOver'}; this.src='"+I+"';\" onmouseout=\"if(className=='buttonOver'){className='button'}; this.src='"+P+'\';" unselectable="on"  width="20" height="20"></span>';L+='<span id="textMode'+C+'"><img src="'+imagesDir+'view_text.gif" border=0 unselectable="on" title="viewText"          id="ViewText"       class="button" onClick="formatText(this.id,\''+C+"');\" onmouseover=\"if(className=='button'){className='buttonOver'}; this.src='"+imagesDir+"view_text_on.gif';\"    onmouseout=\"if(className=='buttonOver'){className='button'}; this.src='"+imagesDir+'view_text.gif\';" unselectable="on"  width="20" height="20"></span>';L+="</td>"}else{L+='<td style="width: 22px;"><img src="'+P+'" border=0 unselectable="on" title="'+G+'" id="'+Q+'" class="button" onClick="formatText(this.id,\''+C+"');\" onmouseover=\"if(className=='button'){className='buttonOver'}; this.src='"+I+"';\" onmouseout=\"if(className=='buttonOver'){className='button'}; this.src='"+P+'\';" unselectable="on" width="20" height="20"></td>'}}}F++}L+="<td>&nbsp;</td></tr></table>";var E='<table cellpadding="0" cellspacing="0" border="0" style="width:'+wysiwygWidth+"px; height:"+wysiwygHeight+'px;border: 1px inset #CCCCCC;"><tr><td valign="top">\n<iframe frameborder="0" id="wysiwyg'+C+'"></iframe>\n</td></tr></table>\n';document.getElementById(C).insertAdjacentHTML("afterEnd",M+L+E);outputFontSelect(C);outputFontSizes(C);hideFonts(C);hideFontSizes(C);document.getElementById("textMode"+C).style.display="none";document.getElementById("wysiwyg"+C).style.height=wysiwygHeight+"px";document.getElementById("wysiwyg"+C).style.width=wysiwygWidth+"px";var J=document.getElementById(C).value;var O=document.getElementById("wysiwyg"+C).contentWindow.document;O.open();O.write(J);O.close();O.body.contentEditable=true;O.designMode="on";var K=navigator.appName;if(K=="Microsoft Internet Explorer"){for(var N=0;N<document.forms.length;N++){document.forms[N].attachEvent("onsubmit",function(){updateTextArea(C)})}}else{for(var N=0;N<document.forms.length;N++){document.forms[N].addEventListener("submit",function D(){updateTextArea(C)},true)}}}function formatText(A,C,F){document.getElementById("wysiwyg"+C).contentWindow.focus();var M=new Array("FontSize","FontName","Bold","Italic","Underline","Subscript","Superscript","Strikethrough","Justifyleft","Justifyright","Justifycenter","InsertUnorderedList","InsertOrderedList","Indent","Outdent","ForeColor","BackColor","InsertImage","InsertTable","CreateLink");for(var G=0;G<=M.length;){if(M[G]==A){var J=1}G++}if(viewTextMode==1&&J==1){alert("You are in HTML Mode. This feature has been disabled.")}else{if(A=="FontSize"){document.getElementById("wysiwyg"+C).contentWindow.document.execCommand("FontSize",false,F)}else{if(A=="FontName"){document.getElementById("wysiwyg"+C).contentWindow.document.execCommand("FontName",false,F)}else{if(A=="ForeColor"||A=="BackColor"){var L=screen.availWidth;var I=screen.availHeight;var B=210,K=165;var D=(L-B)/2,H=(I-K)/2;var E=_dec_to_rgb(document.getElementById("wysiwyg"+C).contentWindow.document.queryCommandValue(A));window.open(popupsDir+"select_color.html?color="+E+"&command="+A+"&wysiwyg="+C,"popup","location=0,status=0,scrollbars=0,width="+B+",height="+K+",top="+H+",left="+D)}else{if(A=="InsertImage"){window.open(popupsDir+"insert_image.html?wysiwyg="+C,"popup","location=0,status=0,scrollbars=0,resizable=0,width=400,height=190")}else{if(A=="InsertTable"){window.open(popupsDir+"create_table.html?wysiwyg="+C,"popup","location=0,status=0,scrollbars=0,resizable=0,width=400,height=360")}else{if(A=="CreateLink"){window.open(popupsDir+"insert_hyperlink.html?wysiwyg="+C,"popup","location=0,status=0,scrollbars=0,resizable=0,width=300,height=110")}else{if(A=="ViewSource"){viewSource(C)}else{if(A=="ViewText"){viewText(C)}else{if(A=="Help"){window.open(popupsDir+"about.html","popup","location=0,status=0,scrollbars=0,resizable=0,width=400,height=330")}else{document.getElementById("wysiwyg"+C).contentWindow.document.execCommand(A,false,null)}}}}}}}}}}}function insertHTML(A,E){var C=navigator.appName;if(C=="Microsoft Internet Explorer"){document.getElementById("wysiwyg"+E).contentWindow.document.selection.createRange().pasteHTML(A)}else{var D=document.getElementById("wysiwyg"+E).contentWindow.document.createElement("div");D.innerHTML=A;var B=insertNodeAtSelection(D,E)}}function insertNodeAtSelection(F,C){var B=document.getElementById("wysiwyg"+C).contentWindow.getSelection();var G=B.getRangeAt(0);B.removeAllRanges();G.deleteContents();var A=G.startContainer;var K=G.startOffset;G=document.createRange();if(A.nodeType==3&&F.nodeType==3){A.insertData(K,F.nodeValue);G.setEnd(A,K+F.length);G.setStart(A,K+F.length)}else{var D;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);D=document.createTextNode(H);A.insertBefore(D,E);A.insertBefore(F,D);A.insertBefore(J,F);A.removeChild(E)}else{D=A.childNodes[K];A.insertBefore(F,D)}G.setEnd(D,0);G.setStart(D,0)}B.addRange(G)}function _dec_to_rgb(D){var B="";for(var A=0;A<3;A++){var C=D&255;D>>=8;var E=C&15;var F=(C>>4)&15;B+=F.toString(16);B+=E.toString(16)}return B.toUpperCase()}function outputFontSelect(F){var A=ToolbarList.selectfont;var B=A[2];var D=A[3];Fonts.sort();var E=new Array;E[F]='<table border="0" cellpadding="0" cellspacing="0"><tr><td onMouseOver="document.getElementById(\'selectFont'+F+"').src='"+D+"';\" onMouseOut=\"document.getElementById('selectFont"+F+"').src='"+B+'\';"><img src="'+B+'" id="selectFont'+F+'" width="85" height="20" onClick="showFonts(\''+F+'\');" unselectable="on"><br>';E[F]+='<span id="Fonts'+F+'" class="dropdown" style="width: 145px;">';for(var C=0;C<=Fonts.length;){if(Fonts[C]){E[F]+="<button type=\"button\" onClick=\"formatText('FontName','"+F+"','"+Fonts[C]+"'); hideFonts('"+F+'\');" onMouseOver="this.className=\'mouseOver\'" onMouseOut="this.className=\'mouseOut\'" class="mouseOut" style="width: 120px;"><table cellpadding="0" cellspacing="0" border="0"><tr><td align="left" style="font-family:'+Fonts[C]+'; font-size: 12px;">'+Fonts[C]+"</td></tr></table></button><br>"}C++}E[F]+="</span></td></tr></table>";document.getElementById("FontSelect"+F).insertAdjacentHTML("afterBegin",E[F])}function outputFontSizes(F){var E=ToolbarList.selectsize;var D=E[2];var C=E[3];FontSizes.sort();var A=new Array;A[F]='<table border="0" cellpadding="0" cellspacing="0"><tr><td onMouseOver="document.getElementById(\'selectSize'+F+"').src='"+C+"';\" onMouseOut=\"document.getElementById('selectSize"+F+"').src='"+D+'\';"><img src="'+D+'" id="selectSize'+F+'" width="49" height="20" onClick="showFontSizes(\''+F+'\');" unselectable="on"><br>';A[F]+='<span id="Sizes'+F+'" class="dropdown" style="width: 170px;">';for(var B=0;B<=FontSizes.length;){if(FontSizes[B]){A[F]+="<button type=\"button\" onClick=\"formatText('FontSize','"+F+"','"+FontSizes[B]+"');hideFontSizes('"+F+'\');" onMouseOver="this.className=\'mouseOver\'" onMouseOut="this.className=\'mouseOut\'" class="mouseOut" style="width: 145px;"><table cellpadding="0" cellspacing="0" border="0"><tr><td align="left" style="font-family: arial, verdana, helvetica;"><font size="'+FontSizes[B]+'">size '+FontSizes[B]+"</font></td></tr></table></button><br>"}B++}A[F]+="</span></td></tr></table>";document.getElementById("FontSizes"+F).insertAdjacentHTML("afterBegin",A[F])}function hideFonts(A){document.getElementById("Fonts"+A).style.display="none"}function hideFontSizes(A){document.getElementById("Sizes"+A).style.display="none"}function showFonts(A){if(document.getElementById("Fonts"+A).style.display=="block"){document.getElementById("Fonts"+A).style.display="none"}else{document.getElementById("Fonts"+A).style.display="block";document.getElementById("Fonts"+A).style.position="absolute"}}function showFontSizes(A){if(document.getElementById("Sizes"+A).style.display=="block"){document.getElementById("Sizes"+A).style.display="none"}else{document.getElementById("Sizes"+A).style.display="block";document.getElementById("Sizes"+A).style.position="absolute"}}function viewSource(E){var C=document.getElementById("wysiwyg"+E).contentWindow.document;var D=navigator.appName;if(D=="Microsoft Internet Explorer"){var A=C.body.innerHTML;C.body.innerText=A}else{var B=document.createTextNode(C.body.innerHTML);C.body.innerHTML="";C.body.appendChild(B)}document.getElementById("HTMLMode"+E).style.display="none";document.getElementById("textMode"+E).style.display="block";C.body.style.fontSize="12px";C.body.style.fontFamily="Courier New";viewTextMode=1}function viewText(E){var B=document.getElementById("wysiwyg"+E).contentWindow.document;var D=navigator.appName;if(D=="Microsoft Internet Explorer"){var C=B.body.innerText;B.body.innerHTML=C}else{var A=B.body.ownerDocument.createRange();A.selectNodeContents(B.body);B.body.innerHTML=A.toString()}document.getElementById("textMode"+E).style.display="none";document.getElementById("HTMLMode"+E).style.display="block";B.body.style.fontSize="";B.body.style.fontFamily="";viewTextMode=0}function updateTextArea(A){document.getElementById(A).value=document.getElementById("wysiwyg"+A).contentWindow.document.body.innerHTML};