imagesDir = "openwysiwyg/icons/"; cssDir = "openwysiwyg/styles/"; popupsDir = "/openwysiwyg/popups/"; wysiwygWidth = 710; wysiwygHeight = 340; document.write('\n'); 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"; Fonts[9] = "Algerian"; Fonts[10] = "Bauhaus 93"; Fonts[11] = "Berlin Sans FB"; Fonts[12] = "Bernard MT Condensed"; Fonts[13] = "Bradley Hand ITC"; Fonts[14] = "Castellar"; Fonts[15] = "Copperplate Gothic Light"; Fonts[16] = "Chiller"; Fonts[17] = "Lucida Calligraphy"; Fonts[18] = "Lucida Handwriting"; Fonts[19] = "Old English Text MT"; Fonts[20] = "STCaiyun"; Fonts[21] = "Small Fonts"; 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[4] = "seperator"; buttonName[5] = "subscript"; buttonName[6] = "superscript"; buttonName[7] = "seperator"; buttonName[8] = "unorderedlist"; buttonName[9] = "orderedlist"; buttonName[12] = "seperator"; buttonName[13] = "forecolor"; buttonName[14] = "backcolor"; buttonName[15] = "seperator"; buttonName[16] = "cut"; buttonName[17] = "copy"; buttonName[18] = "paste"; buttonName[19] = "seperator"; buttonName[20] = "undo"; buttonName[21] = "redo"; buttonName[22] = "seperator"; buttonName[23] = "inserttable"; buttonName[24] = "insertimage"; buttonName[25] = "createlink"; buttonName[26] = "seperator"; buttonName[27] = "charsup"; buttonName[28] = "seperator"; var ToolbarList = { //Name buttonID buttonTitle buttonImage buttonImageRollover "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_on.gif'], "subscript": ['Subscript', 'Subscript', imagesDir + 'subscript_on.gif', imagesDir + 'subscript.gif'], "superscript": ['Superscript', 'Superscript', imagesDir + 'superscript_on.gif', imagesDir + 'superscript.gif'], "unorderedlist": ['InsertUnorderedList', 'InsertUnorderedList',imagesDir + 'list_unordered_on.gif', imagesDir + 'list_unordered.gif'], "orderedlist": ['InsertOrderedList', 'InsertOrderedList', imagesDir + 'list_ordered_on.gif', imagesDir + 'list_ordered.gif'], "cut": ['Cut', 'Cut', imagesDir + 'cut_on.gif', imagesDir + 'cut.gif'], "copy": ['Copy', 'Copy', imagesDir + 'copy_on.gif', imagesDir + 'copy.gif'], "paste": ['Paste', 'Paste', imagesDir + 'paste_on.gif', imagesDir + 'paste.gif'], "forecolor": ['ForeColor', 'ForeColor', imagesDir + 'forecolor_on.gif', imagesDir + 'forecolor.gif'], "backcolor": ['BackColor', 'BackColor', imagesDir + 'backcolor_on.gif', imagesDir + 'backcolor.gif'], "undo": ['Undo', 'Undo', imagesDir + 'undo_on.gif', imagesDir + 'undo.gif'], "redo": ['Redo', 'Redo', imagesDir + 'redo_on.gif', imagesDir + 'redo.gif'], "inserttable": ['InsertTable', 'InsertTable', imagesDir + 'insert_table_on.gif', imagesDir + 'insert_table.gif'], "insertimage": ['InsertImage', 'InsertImage', imagesDir + 'insert_picture_on.gif', imagesDir + 'insert_picture.gif'], "createlink": ['CreateLink', 'CreateLink', imagesDir + 'insert_hyperlink_on.gif', imagesDir + 'insert_hyperlink.gif'], "charsup": ['CharSup', 'Supported Characters/Symbols', imagesDir + 'char_on.gif', imagesDir + 'char.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 (where,parsedNode) { switch (where){ case 'beforeBegin': this.parentNode.insertBefore(parsedNode,this) break; case 'afterBegin': this.insertBefore(parsedNode,this.firstChild); break; case 'beforeEnd': this.appendChild(parsedNode); break; case 'afterEnd': if (this.nextSibling) this.parentNode.insertBefore(parsedNode,this.nextSibling); else this.parentNode.appendChild(parsedNode); break; } } HTMLElement.prototype.insertAdjacentHTML = function (where,htmlStr) { var r = this.ownerDocument.createRange(); r.setStartBefore(this); var parsedHTML = r.createContextualFragment(htmlStr); this.insertAdjacentElement(where,parsedHTML) } HTMLElement.prototype.insertAdjacentText = function (where,txtStr) { var parsedText = document.createTextNode(txtStr) this.insertAdjacentElement(where,parsedText) } }; viewTextMode = 0; function generate_wysiwyg(textareaID) { document.getElementById(textareaID).style.display = 'none'; var n = textareaID; toolbarWidth = parseFloat(wysiwygWidth) + 2; var toolbar; toolbar = ''; toolbar += ''; toolbar += ''; for (var i = 0; i <= buttonName.length;) { if (buttonName[i]) { var buttonObj = ToolbarList[buttonName[i]]; var buttonID = buttonObj[0]; var buttonTitle = buttonObj[1]; var buttonImage = buttonObj[2]; var buttonImageRollover = buttonObj[3]; if (buttonName[i] == "seperator") { toolbar += ''; } else { toolbar += ''; } } i++; } toolbar += '
 
'; var iframe = '
\n' + '\n' + '
\n'; document.getElementById(n).insertAdjacentHTML("afterEnd", toolbar + iframe); outputFontSelect(n); outputFontSizes(n); hideFonts(n); hideFontSizes(n); document.getElementById("wysiwyg" + n).style.height = wysiwygHeight + "px"; document.getElementById("wysiwyg" + n).style.width = wysiwygWidth + "px"; var content = document.getElementById(n).value; var doc = document.getElementById("wysiwyg" + n).contentWindow.document; doc.open(); doc.write(content); doc.close(); doc.body.contentEditable = true; doc.designMode = "on"; var browserName = navigator.appName; if (browserName == "Microsoft Internet Explorer"||browserName == "Opera") { for (var idx=0; idx < document.forms.length; idx++) { document.forms[idx].attachEvent('onsubmit', function() { updateTextArea(n); }); } } else { for (var idx=0; idx < document.forms.length; idx++) { document.forms[idx].addEventListener('submit',function OnSumbmit() { updateTextArea(n); }, true); } } }; function formatText(id, n, selected) { document.getElementById("wysiwyg" + n).contentWindow.focus(); var formatIDs = new Array("FontSize","FontName","Bold","Italic","Underline","Subscript","Superscript","Strikethrough","InsertUnorderedList","InsertOrderedList","ForeColor","BackColor","InsertImage","InsertTable","CreateLink","CharSup"); for (var i = 0; i <= formatIDs.length;) { if (formatIDs[i] == id) { var disabled_id = 1; } i++; } if (viewTextMode == 1 && disabled_id == 1) { alert ("You are in HTML Mode. This feature has been disabled."); } else { if (id == "FontSize") { document.getElementById("wysiwyg" + n).contentWindow.document.execCommand("FontSize", false, selected); } else if (id == "FontName") { document.getElementById("wysiwyg" + n).contentWindow.document.execCommand("FontName", false, selected); } else if (id == 'ForeColor' || id == 'BackColor') { var w = screen.availWidth; var h = screen.availHeight; var popW = 210, popH = 165; var leftPos = (w-popW)/2, topPos = (h-popH)/2; var currentColor = _dec_to_rgb(document.getElementById("wysiwyg" + n).contentWindow.document.queryCommandValue(id)); window.open(popupsDir + 'select_color.html#color=' + currentColor + '&command=' + id + '&wysiwyg=' + n,'popup','location=0,status=0,scrollbars=0,width=' + popW + ',height=' + popH + ',top=' + topPos + ',left=' + leftPos); } else if (id == "InsertImage") { window.open(popupsDir + 'insert_image.html#wysiwyg=' + n,'popup','location=0,status=0,scrollbars=0,resizable=0,width=400,height=190'); } else if (id == "InsertTable") { window.open(popupsDir + 'create_table.html#wysiwyg=' + n,'popup','location=0,status=0,scrollbars=0,resizable=0,width=400,height=360'); } else if (id == "CreateLink") { window.open(popupsDir + 'insert_hyperlink.html#wysiwyg=' + n,'popup','location=0,status=0,scrollbars=0,resizable=0,width=300,height=110'); } else if (id == "CharSup") { window.open(popupsDir + 'supportedchars.html#wysiwyg=' + n,'popup','location=0,status=0,scrollbars=0,resizable=0,width=900,height=260'); } else { document.getElementById("wysiwyg" + n).contentWindow.document.execCommand(id, false, null); } } }; function insertHTML(html, n) { var browserName = navigator.appName; if (browserName == "Microsoft Internet Explorer") { document.getElementById('wysiwyg' + n).contentWindow.document.selection.createRange().pasteHTML(html); } else { var div = document.getElementById('wysiwyg' + n).contentWindow.document.createElement("span"); div.innerHTML = html; var node = insertNodeAtSelection(div, n); } } function insertNodeAtSelection(insertNode, n) { var sel = document.getElementById('wysiwyg' + n).contentWindow.getSelection(); var range = sel.getRangeAt(0); sel.removeAllRanges(); range.deleteContents(); var container = range.startContainer; var pos = range.startOffset; range=document.createRange(); if (container.nodeType==3 && insertNode.nodeType==3) { container.insertData(pos, insertNode.nodeValue); range.setEnd(container, pos+insertNode.length); range.setStart(container, pos+insertNode.length); } else { var afterNode; if (container.nodeType==3) { var textNode = container; container = textNode.parentNode; var text = textNode.nodeValue; var textBefore = text.substr(0,pos); var textAfter = text.substr(pos); var beforeNode = document.createTextNode(textBefore); afterNode = document.createTextNode(textAfter); container.insertBefore(afterNode, textNode); container.insertBefore(insertNode, afterNode); container.insertBefore(beforeNode, insertNode); container.removeChild(textNode); } else { afterNode = container.childNodes[pos]; container.insertBefore(insertNode, afterNode); } range.setEnd(afterNode, 0); range.setStart(afterNode, 0); } sel.addRange(range); }; function _dec_to_rgb(value) { var hex_string = ""; for (var hexpair = 0; hexpair < 3; hexpair++) { var myByte = value & 0xFF; value >>= 8; var nybble2 = myByte & 0x0F; var nybble1 = (myByte >> 4) & 0x0F; hex_string += nybble1.toString(16); hex_string += nybble2.toString(16); } return hex_string.toUpperCase(); }; function outputFontSelect(n) { var FontSelectObj = ToolbarList['selectfont']; var FontSelect = FontSelectObj[2]; var FontSelectOn = FontSelectObj[3]; Fonts.sort(); var FontSelectDropDown = new Array; FontSelectDropDown[n] = '

'; FontSelectDropDown[n] += ''; for (var i = 0; i <= Fonts.length;) { if (Fonts[i]) { FontSelectDropDown[n] += '
'; } i++; } FontSelectDropDown[n] += '
'; document.getElementById('FontSelect' + n).insertAdjacentHTML("afterBegin", FontSelectDropDown[n]); }; function outputFontSizes(n) { var FontSizeObj = ToolbarList['selectsize']; var FontSize = FontSizeObj[2]; var FontSizeOn = FontSizeObj[3]; FontSizes.sort(); var FontSizesDropDown = new Array; FontSizesDropDown[n] = '

'; FontSizesDropDown[n] += ''; for (var i = 0; i <= FontSizes.length;) { if (FontSizes[i]) { FontSizesDropDown[n] += '
'; } i++; } FontSizesDropDown[n] += '
'; document.getElementById('FontSizes' + n).insertAdjacentHTML("afterBegin", FontSizesDropDown[n]); }; function hideFonts(n) { document.getElementById('Fonts' + n).style.display = 'none'; }; function hideFontSizes(n) { document.getElementById('Sizes' + n).style.display = 'none'; }; function showFonts(n) { if (document.getElementById('Fonts' + n).style.display == 'block') { document.getElementById('Fonts' + n).style.display = 'none'; } else { document.getElementById('Fonts' + n).style.display = 'block'; document.getElementById('Fonts' + n).style.position = 'absolute'; } }; function showFontSizes(n) { if (document.getElementById('Sizes' + n).style.display == 'block') { document.getElementById('Sizes' + n).style.display = 'none'; } else { document.getElementById('Sizes' + n).style.display = 'block'; document.getElementById('Sizes' + n).style.position = 'absolute'; } }; function viewSource(n) { var getDocument = document.getElementById("wysiwyg" + n).contentWindow.document; var browserName = navigator.appName; if (browserName == "Microsoft Internet Explorer") { var iHTML = getDocument.body.innerHTML; getDocument.body.innerText = iHTML; } else { var html = document.createTextNode(getDocument.body.innerHTML); getDocument.body.innerHTML = ""; getDocument.body.appendChild(html); } getDocument.body.style.fontSize = "12px"; getDocument.body.style.fontFamily = "Courier New"; viewTextMode = 1; }; function viewText(n) { var getDocument = document.getElementById("wysiwyg" + n).contentWindow.document; var browserName = navigator.appName; if (browserName == "Microsoft Internet Explorer") { var iText = getDocument.body.innerText; getDocument.body.innerHTML = iText; } else { var html = getDocument.body.ownerDocument.createRange(); html.selectNodeContents(getDocument.body); getDocument.body.innerHTML = html.toString(); } getDocument.body.style.fontSize = "11px"; getDocument.body.style.fontFamily = "Verdana, Arial, Sans Serif, Courier New"; viewTextMode = 0; }; var pString; function prepl(elemID) { if (elemID=="wysiwygrepArea") { pString = document.getElementById(elemID).contentWindow.document.body.innerHTML; } else { pString = document.getElementById(elemID).value; } pString = pString.replace(/&/gi, "&"); pString = pString.replace(/</gi, "<"); pString = pString.replace(/>/gi, ">"); pString = pString.replace(/"/gi, "\""); pString = pString.replace(/http:\/\/forum.teledos.gr:2006/gi, ""); pString = pString.replace(/http/gi, "httpaddress"); pString = pString.replace(/mailto/gi, "mailtoaddress"); pString = pString.replace(/ftp/gi, "ftpaddress"); pString = pString.replace(//gi, 'notallowedtag end'); pString = pString.replace(//gi, 'notallowedtag end'); pString = pString.replace(//gi, 'notallowedtag end'); pString = pString.replace(/