// // TextAreaPro v1.0 - Copyright (c) 2004 akwebtools.com // This copyright notice MUST stay intact for use (see license.txt). // var mode = "WYSIWYG"; var subdirectory = "ak_images/"; var txtareaname1 = null; var txtareaname2 = null; var buttonlist = Array( 'FontName', 'FontSize', //'SelectAll', //'Delete', 'Cut', 'Copy', 'Paste', //'SaveAs', //'Print', 'Separator', 'Bold', 'Italic', 'Underline', 'Strikethrough', 'Separator', 'JustifyLeft', 'JustifyCenter', 'JustifyRight', 'JustifyFull', 'Separator', 'InsertOrderedList', 'InsertUnorderedList', 'Outdent', 'Indent', 'Separator', 'SuperScript', 'SubScript', //'Separator', 'InsertHorizontalRule', //'CreateLink', //'Unlink', //'Image', //'Table', //'SpecialChars', 'Separator', 'Forecolor', 'Backcolor' //'Separator', //'Date', //'ChangeMode', //'Separator' //'Help' ); var menuButtons = { // button id images help text click&hold statuscheck Disable(html mode) //"SelectAll": ['mn_selectall.gif', 'Select All', '0', '0', '0'], //"Delete": ['mn_delete.gif', 'Delete', '0', '0', '0'], "Cut": ['mn_cut.gif', 'Cut', '0', '0', '0'], "Copy": ['mn_copy.gif', 'Copy', '0', '0', '0'], "Paste": ['mn_paste.gif', 'Paste', '0', '0', '0'], //"SaveAs": ['mn_saveas.gif', 'Save As', '0', '0', '0'], //"Print": ['mn_print.gif', 'Print', '0', '0', '0'], "Bold": ['mn_bold.gif', 'Bold', '1', '1', '1'], "Italic": ['mn_italic.gif', 'Italic', '1', '1', '1'], "Underline": ['mn_underline.gif', 'Underline', '1', '1', '1'], "Strikethrough": ['mn_strikethrough.gif', 'Strikethrough', '1', '1', '1'], "JustifyLeft": ['mn_justifyleft.gif', 'Justify Left', '1', '1', '1'], "JustifyCenter": ['mn_justifycenter.gif', 'Justify Center', '1', '1', '1'], "JustifyRight": ['mn_justifyright.gif', 'Justify Right', '1', '1', '1'], "JustifyFull": ['mn_justifyfull.gif', 'Justify Full', '1', '1', '1'], "InsertOrderedList": ['mn_insertorderedlist.gif', 'Insert Ordered List', '1', '1', '1'], "InsertUnorderedList": ['mn_insertunorderedlist.gif', 'Insert Unordered List', '1', '1', '1'], "Outdent": ['mn_outindent.gif', 'Outdent', '0', '0', '1'], "Indent": ['mn_indent.gif', 'Indent', '0', '0', '1'], "SuperScript": ['mn_superscript.gif', 'Superscript', '0', '1', '1'], "SubScript": ['mn_subscript.gif', 'Subscript', '0', '1', '1'], "InsertHorizontalRule": ['mn_inserthorizontalrule.gif', 'Insert Horizontal Rule', '0', '0', '1'], //"CreateLink": ['mn_createlink.gif', 'Create Link', '0', '0', '1'], //"Unlink": ['mn_unlink.gif', 'Remove Link', '0', '0', '1'], //"Image": ['mn_image.gif', 'Insert Image', '0', '0', '1'], //"Table": ['mn_table.gif', 'Insert Table', '0', '0', '1'], //"SpecialChars": ['mn_specialchars.gif', 'Special Characters', '0', '0', '1'], "Forecolor": ['mn_forecolor.gif', 'Forecolor', '0', '0', '1'], "Backcolor": ['mn_backcolor.gif', 'Backcolor', '0', '0', '1'] //"Date": ['mn_date.gif', 'Insert Date', '0', '0', '1'] //"ChangeMode": ['mn_changemode.gif', 'Change Mode', '1', '0', '0'] //"Help": ['mn_help.gif', 'Help', '0', '0', '0'] }; document.writeln(''); function ak_wysiwyg_generator(width, height, txtarea_name1, bnconfig) { if (!width) {width = 600;}; if (!height) {height = 500;}; var iebrowser_version = parseFloat(navigator.appVersion.split("MSIE")[1]); if (navigator.userAgent.indexOf('Mac')>=0 || navigator.userAgent.indexOf('Windows CE')>=0 || navigator.userAgent.indexOf('Opera')>=0) { iebrowser_version = 0;} if (iebrowser_version >= 5.5) { //Begin of WYSIWYG editor if (txtarea_name1) { document.getElementById(txtarea_name1).style.display="none"; txtareaname1 = txtarea_name1; } if (bnconfig) {buttonlist = bnconfig;} if (AK_editor_url) {subdirectory = AK_editor_url + subdirectory} document.writeln('
'); for (var j=0; j'); } else if (buttonlist[j] == 'FontName') { document.writeln(' '); } else if (buttonlist[j] == 'FontSize') { document.writeln(''); } else { if (menuButtons[buttonlist[j]][2]=='1') { document.writeln(''); } else { document.writeln(''); } } } //document.writeln(' '); document.writeln('
'); document.writeln(''); myEditor.document.designMode = 'On'; if (txtareaname1) { var command = "myEditor.document.body.innerHTML = document.getElementById(txtareaname1).value;" setTimeout(command,500); } frames['myEditor'].document.onkeyup = keyHandler; frames['myEditor'].document.onmouseup = keyHandler; document.keydown = externalkeyHandler; document.onmousedown = externalkeyHandler; //End of WYSIWYG editor } else if (!txtarea_name1) { document.writeln(''); } } function ak_fontname() { //myEditor.focus(); var name = document.getElementById('bn_ak_fontname').value; myEditor.document.execCommand('FontName', false, name); } function ak_fontsize() { //myEditor.focus(); var size = document.getElementById('bn_ak_fontsize').value; myEditor.document.execCommand('FontSize', false, size); } function ak_bold() { //myEditor.focus(); myEditor.document.execCommand('Bold', false, null); } function ak_italic() { //myEditor.focus(); myEditor.document.execCommand('Italic', false, null); } function ak_underline() { //myEditor.focus(); myEditor.document.execCommand('Underline', false, null); myEditor2.document.execCommand('Underline', false, null); } function ak_strikethrough() { //myEditor.focus(); myEditor.document.execCommand('StrikeThrough', false, null); myEditor2.document.execCommand('StrikeThrough', false, null); } function ak_createlink() { //myEditor.focus(); myEditor.document.execCommand('CreateLink', true, null); myEditor2.document.execCommand('CreateLink', true, null); } function ak_unlink() { //myEditor.focus(); myEditor.document.execCommand('Unlink', false, null); myEditor2.document.execCommand('Unlink', false, null); } function ak_print() { //myEditor.focus(); myEditor.document.execCommand('Print', false, null); myEditor2.document.execCommand('Print', false, null); } function ak_selectall() { //myEditor.focus(); myEditor.document.execCommand('SelectAll', false, null); myEditor2.document.execCommand('SelectAll', false, null); } function ak_delete() { //myEditor.focus(); myEditor.document.execCommand('Delete', false, null); myEditor2.document.execCommand('Delete', false, null); } function ak_copy() { //myEditor.focus(); myEditor.document.execCommand('Copy', false, null); myEditor2.document.execCommand('Copy', false, null); } function ak_paste() { //myEditor.focus(); myEditor.document.execCommand('Paste', false, null); myEditor2.document.execCommand('Paste', false, null); } function ak_cut() { //myEditor.focus(); myEditor.document.execCommand('Cut', false, null); myEditor2.document.execCommand('Cut', false, null); } function ak_inserthorizontalrule() { //myEditor.focus(); myEditor.document.execCommand('InsertHorizontalRule', false, null); myEditor2.document.execCommand('InsertHorizontalRule', false, null); } function ak_saveas() { //myEditor.focus(); myEditor.document.execCommand('SaveAs', true, "Untitled"); myEditor2.document.execCommand('SaveAs', true, "Untitled"); } function ak_indent() { //myEditor.focus(); myEditor.document.execCommand('Indent', false, null); myEditor2.document.execCommand('Indent', false, null); } function ak_outdent() { //myEditor.focus(); myEditor.document.execCommand('Outdent', false, null); myEditor2.document.execCommand('Outdent', false, null); } function ak_insertunorderedlist() { //myEditor.focus(); document.getElementById('bn_ak_insertorderedlist').className='btn'; myEditor.document.execCommand('insertUnorderedList', false, null); myEditor2.document.execCommand('insertUnorderedList', false, null); } function ak_insertorderedlist() { //myEditor.focus(); document.getElementById('bn_ak_insertunorderedlist').className='btn'; myEditor.document.execCommand('insertOrderedList', false, null); myEditor2.document.execCommand('insertOrderedList', false, null); } function ak_justifyleft() { //myEditor.focus(); document.getElementById('bn_ak_justifyright').className='btn'; document.getElementById('bn_ak_justifycenter').className='btn'; document.getElementById('bn_ak_justifyfull').className='btn'; document.getElementById('bn_ak_justifyfull').disabled=false; document.getElementById('bn_ak_justifyright').disabled=false; document.getElementById('bn_ak_justifycenter').disabled=false; document.getElementById('bn_ak_justifyleft').disabled=true; myEditor.document.execCommand('justifyLeft', false, null); myEditor2.document.execCommand('justifyLeft', false, null); } function ak_justifycenter() { //myEditor.focus(); document.getElementById('bn_ak_justifyright').className='btn'; document.getElementById('bn_ak_justifyleft').className='btn'; document.getElementById('bn_ak_justifyfull').className='btn'; document.getElementById('bn_ak_justifyfull').disabled=false; document.getElementById('bn_ak_justifyright').disabled=false; document.getElementById('bn_ak_justifycenter').disabled=true; document.getElementById('bn_ak_justifyleft').disabled=false; myEditor.document.execCommand('justifyCenter', false, null); myEditor2.document.execCommand('justifyCenter', false, null); } function ak_justifyright() { //myEditor.focus(); document.getElementById('bn_ak_justifyleft').className='btn'; document.getElementById('bn_ak_justifycenter').className='btn'; document.getElementById('bn_ak_justifyfull').className='btn'; document.getElementById('bn_ak_justifyfull').disabled=false; document.getElementById('bn_ak_justifyright').disabled=true; document.getElementById('bn_ak_justifycenter').disabled=false; document.getElementById('bn_ak_justifyleft').disabled=false; myEditor.document.execCommand('justifyRight', false, null); myEditor2.document.execCommand('justifyRight', false, null); } function ak_justifyfull() { //myEditor.focus(); document.getElementById('bn_ak_justifyleft').className='btn'; document.getElementById('bn_ak_justifycenter').className='btn'; document.getElementById('bn_ak_justifyright').className='btn'; document.getElementById('bn_ak_justifyfull').disabled=true; document.getElementById('bn_ak_justifyright').disabled=false; document.getElementById('bn_ak_justifycenter').disabled=false; document.getElementById('bn_ak_justifyleft').disabled=false; myEditor.document.execCommand('JustifyFull', false, null); myEditor2.document.execCommand('JustifyFull', false, null); } function ak_superscript() { //myEditor.focus(); if (myEditor.document.queryCommandValue('SuperScript')) { myEditor.document.execCommand('RemoveFormat'); } else { myEditor.document.execCommand('SuperScript'); } if (myEditor2.document.queryCommandValue('SuperScript')) { myEditor2.document.execCommand('RemoveFormat'); } else { myEditor2.document.execCommand('SuperScript'); } updatetoolbar(); } function ak_subscript() { //myEditor.focus(); if (myEditor.document.queryCommandValue('SubScript')) { myEditor.document.execCommand('RemoveFormat'); } else { myEditor.document.execCommand('SubScript'); } if (myEditor2.document.queryCommandValue('SubScript')) { myEditor2.document.execCommand('RemoveFormat'); } else { myEditor2.document.execCommand('SubScript'); } updatetoolbar(); } function ak_backcolor() { var mycolor = showModalDialog(subdirectory + "insertcolors.html", "", "dialogHeight:230px; dialogWidth: 250px; scroll: no; status: no; help: no;"); //myEditor.focus(); myEditor.document.execCommand('BackColor', true, mycolor); myEditor2.document.execCommand('BackColor', true, mycolor); } function ak_forecolor() { var mycolor = showModalDialog(subdirectory + "insertcolors.html", "", "dialogHeight:230px; dialogWidth: 250px; scroll: no; status: no; help: no;"); //myEditor.focus(); myEditor.document.execCommand('ForeColor', true, mycolor); myEditor2.document.execCommand('ForeColor', true, mycolor); } function ak_image() { var myimage = showModalDialog(subdirectory + "insertimage.html", "", "dialogHeight:230px; dialogWidth: 420px; scroll: no; status: no; help: no;"); if (myimage){ ak_inserttags(myimage, ""); } } function ak_table() { var mytable = showModalDialog(subdirectory + "inserttable.html", "", "dialogHeight:160px; dialogWidth: 325px; scroll: no; status: no; help: no;"); if (mytable){ ak_inserttags(mytable, ""); } } function ak_date() { var myday = showModalDialog(subdirectory + "insertdate.html", "", "dialogHeight:190px; dialogWidth: 215px; scroll: no; status: no; help: no;"); if (myday){ ak_inserttags(myday, ""); } } function ak_specialchars() { var mychar = showModalDialog(subdirectory + "insertcharacters.html", "", "dialogHeight:400px; dialogWidth: 340px; scroll: no; status: no; help: no;"); if (mychar && mychar != ""){ ak_inserttags(mychar, ""); } } function ak_help() { showModalDialog(subdirectory + "help.html", "", "dialogHeight:300px; dialogWidth: 400px; scroll: no; status: no; help: no;"); } function ak_info() { showModalDialog(subdirectory + "aboutus.html", "", "dialogHeight:210px; dialogWidth: 360px; scroll: no; status: no; help: no;"); } function ak_inserttags(str1, str2) { //myEditor.focus(); var tr = myEditor.document.selection.createRange(); if (str2 != ""){tr.pasteHTML(str1 + tr.text + str2);} else {tr.pasteHTML(str1);} tr.select(); var tr2 = myEditor2.document.selection.createRange(); if (str2 != ""){tr2.pasteHTML(str1 + tr2.text + str2);} else {tr2.pasteHTML(str1);} tr2.select(); //myEditor.focus(); } function ak_changemode() { if (mode == 'html') { innerTmp = myEditor.document.body.innerText; myEditor.document.body.innerHTML = innerTmp; mode = 'WYSIWYG' ; enablebuttons(); }else{ innerTmp = myEditor.document.body.innerHTML; myEditor.document.body.innerText = innerTmp; mode = 'html' ; disablebuttons(); } var s = myEditor.document.body.createTextRange(); s.collapse(false); s.select(); } function m_over(obj){ if(obj.className=='btn'){obj.className='btnOver'}; } function m_out(obj){ if(obj.className=='btnOver'){obj.className='btn'}; } function m_click(obj){ if(obj.className !='btnDown'){obj.className='btnDown';} else {obj.className='btn'}; } function copycontents() { if (txtareaname1) { document.getElementById(txtareaname1).value = myEditor.document.body.innerHTML; } if (txtareaname2) { document.getElementById(txtareaname2).value = myEditor2.document.body.innerHTML; } } function keyHandler() { updatetoolbar(); } function externalkeyHandler() { copycontents(); } function updatetoolbar() { //myEditor.focus(); //check current text with button's state. for (var i=0; i