function GetCurElement(el,make,event) { var sel=document.selection; var s=sel.createRange(); var s_par_id=''; var s2=''; var tg_name=''; if (document.all['switchMode'].checked==false) { document.all['ctlFont'].disabled = document.all['ctlSize'].disabled = document.all['btnPost'].disabled = false; } if(sel.type=="Control") { if(document.selection.createRange().item(0).tagName=="TABLE") { document.images["addrow"].disabled = false; document.images["addrow"].className = ''; document.images["addcolumn"].disabled = false; document.images["addcolumn"].className = ''; document.images['delcolumn'].disabled=true; document.images['delcolumn'].className = 'disabled'; document.images['delrow'].disabled=true; document.images['delrow'].className = 'disabled'; document.images['mrgcolumn'].disabled=true; document.images['mrgcolumn'].className = 'disabled'; document.images['mrgrow'].disabled=true; document.images['mrgrow'].className = 'disabled'; document.all['ctlFont'].disabled = document.all['ctlSize'].disabled = document.all['btnPost'].disabled = true; var oTable = document.selection.createRange().item(0); var nRowCount = oTable.rows.length; var nColsCount = oTable.rows(0).cells.length; tr_id=oTable.rows[nRowCount-1].uniqueID; tbl_id=oTable.uniqueID; if (el=='column')add_column(nColsCount,tbl_id,'last'); else if (el=='row')add_row(nRowCount,tbl_id,'last'); } }; else { s_par= s.parentElement(); s_par_uid= s_par.uniqueID; s_par_tagName=s_par.tagName; if (document.all[s_par_uid].id) s_par_id=document.all[s_par_uid].id; if (document.all[s_par_uid].id) s_par_id=document.all[s_par_uid].id; for(tg_name=s_par.tagName;tg_name!='TD'&&s_par_id!='edit'&&s_par_tagName!='BODY';)//&&s_par_id;) { s_uid=s_par.uniqueID; s_par=document.all[s_uid].parentElement; s_par_uid=s_par.uniqueID; tg_name=s_par.tagName; s_par_id=s_par.id; s_par_tagName=s_par.tagName; } if (s_par_id!='edit'&&s_par_tagName!='BODY') { document.images["addrow"].disabled = false; document.images["addrow"].className = ''; document.images["addcolumn"].disabled = false; document.images["addcolumn"].className = ''; document.images['delcolumn'].disabled=false; document.images['delcolumn'].className = ''; document.images['delrow'].disabled=false; document.images['delrow'].className = ''; document.images['mrgcolumn'].disabled=false; document.images['mrgcolumn'].className = ''; document.images['mrgrow'].disabled=false; document.images['mrgrow'].className = ''; s_par_index=s_par.cellIndex tr_id=document.all[s_par_uid].parentElement.uniqueID; tr_index=document.all[s_par_uid].parentElement.rowIndex; tbl_id=document.all[tr_id].parentElement.uniqueID; td_index=document.all[s_par_uid].cellIndex; td_rowspan=document.all[s_par_uid].rowSpan; if (el=='column') { td_index=document.all[s_par_uid].cellIndex; if(make=='add') add_column(td_index,tbl_id); else if (make=='del') del_column(td_index,tbl_id); else if(make=='mrg'&&s_par.cellIndex<(document.all[tr_id].cells.length-1)&&document.all[tr_id].cells(s_par_index).rowSpan==document.all[tr_id].cells(s_par_index+1).rowSpan) mrg_column(tr_id,s_par_index); } else { tr_index=document.all[s_par_uid].parentElement.rowIndex; if(make=='add') add_row(tr_index,tbl_id); else if (make=='del') del_row(tr_index,tbl_id); else if (make=='mrg'&&document.all[tbl_id].rows[tr_index+td_rowspan]&&document.all[tbl_id].rows[tr_index+td_rowspan].cells[td_index]) mrg_row(tbl_id,tr_index,td_index,td_rowspan); } } else{ document.images["addrow"].disabled = true; document.images["addrow"].className = 'disabled'; document.images["addcolumn"].disabled = true; document.images["addcolumn"].className = 'disabled'; document.images['delcolumn'].disabled=true; document.images['delcolumn'].className = 'disabled'; document.images['delrow'].disabled=true; document.images['delrow'].className = 'disabled'; document.images['mrgcolumn'].disabled=true; document.images['mrgcolumn'].className = 'disabled'; document.images['mrgrow'].disabled=true; document.images['mrgrow'].className = 'disabled'; } } } function hover(on) { var el = window.event.srcElement; if (el && !el.disabled && el.nodeName == "IMG" && el.className != "spacer") { if (on) { if(el.className!='down')el.className = "hover"; document.all['color'].style.display = 'none'; setState(document.all['btnText'], false); setState(document.all['btnFill'], false); } else { el.className = el.defaultState ? el.defaultState : null; } } } function press(on) { var el = window.event.srcElement; if (el && !el.disabled && el.nodeName == "IMG" && el.className != "spacer") { if (on) { el.className = "down"; } else { el.className = el.className == "down" ? "hover" : el.defaultState ? el.defaultState : null; } } } function selValue(el, str) { for (var i = 0; i < el.length; i++) { if ((!el[i].value && el[i].text == str) || el[i].value == str) { el.selectedIndex = i; return; } } el.selectedIndex = 0; } function setState(el, on) { if (!el.disabled) { if (on) { el.defaultState = el.className = "down"; } else { el.defaultState = el.className = null; } } } function div_reset(el) { if (!el) document.all['color'].style.display = 'none',setState(document.all['btnText'], false), setState(document.all['btnFill'], false); if (!el || el == ctlFont) selValue(document.all['ctlFont'], document.queryCommandValue('FontName')); if (!el || el == ctlSize) selValue(document.all['ctlSize'], document.queryCommandValue('FontSize')); if (!el || el == btnBold) setState(document.all['btnBold'], document.queryCommandValue('Bold')); if (!el || el == btnItalic) setState(document.all['btnItalic'], document.queryCommandValue('Italic')); if (!el || el == btnUnderline) setState(document.all['btnUnderline'], document.queryCommandValue('Underline')); if (!el || el == btnStrikethrough) setState(document.all['btnStrikethrough'], document.queryCommandValue('Strikethrough')); if (!el || el == btnLeftJustify) setState(document.all['btnLeftJustify'], document.queryCommandValue('JustifyLeft')); if (!el || el == btnCenter) setState(document.all['btnCenter'], document.queryCommandValue('JustifyCenter')); if (!el || el == btnRightJustify) setState(document.all['btnRightJustify'], document.queryCommandValue('JustifyRight')); if (!el || el == btnFullJustify) setState(document.all['btnFullJustify'], document.queryCommandValue('JustifyFull')); if (!el || el == btnNumList) setState(document.all['btnNumList'], document.queryCommandValue('InsertOrderedList')); if (!el || el == btnBulList) setState(document.all['btnBulList'], document.queryCommandValue('InsertUnorderedList')); } function insertHtml(html) { document.focus(); var sel = document.selection.createRange(); sel.pasteHTML(html); save(); } function changeMode() { if (document.all['switchMode'].checked == true) { img_length=document.images.length; for(i=0;i$1"); var imgtag = /(<IMG[ ]*[\w\=\"\'\.\/\;\: \)\(-]*>)<\/span>/gi; html = html.replace(imgtag,"$1"); var formtag = /(<[\/]*(form|input){1}[ ]*[\w\=\"\'\.\/\;\: \)\(-]*>)<\/span>/gi; html = html.replace(formtag,"
$1"); var tabletag = /(<[\/]*(table|tbody|th|tr|td){1}([ ]*[\w\=\"\'\.\/\;\:\)\(-]*){0,}>)<\/span>/gi; html = html.replace(tabletag,"$1"); var Atag = /(<\/a>){1}<\/span>/gi; html = html.replace(Atag,"$1"); var Atag = /(<a [\W _\w\=\"\'\.\/\;\:\)\(-]+>){1,}<\/span>/gi; html = html.replace(Atag,"$1"); var parameter = /=("[ \w\'\.\/\;\:\)\(-]+"|'[ \w\"\.\/\;\:\)\(-]+')/gi; html = html.replace(parameter,"=$1"); var entity = /&([\w]+);/gi; html = html.replace(entity,"&$1;"); var comment = /(<\!--[\W _\w\=\"\'\.\/\;\:\)\(-]*-->)/gi; html = html.replace(comment,"
$1"); html = html.replace(/_AT_/gi,"@"); html = html.replace(/_HASH_/gi,"#"); return html; } function replaceAbsoluteUrls(html) { var docLoc = document.location.toString(); docLoc = docLoc.substring(0,docLoc.lastIndexOf("/")+1); docLoc = docLoc.replace(/\//gi,"\\\/"); var re = eval("/"+docLoc+"/gi"); return html.replace(re, ""); } function replaceTags(set, html) { var re; for(var i = 0; i < set.length; i++) { re = eval("/(<[\/]{0,1})"+set[i][0]+">/gi"); html=html.replace(re,"$1"+set[i][1]+">"); } return html } function codeSweeper() { var html = edit.innerHTML; if (html) html = replaceAbsoluteUrls(html); if (html) html = replaceTags([["strong","B"],["em","I"]],html); return html; } function Exec(n) { if (document.all['switchMode'].checked ==true ) return; if (document.forms.f0.saveflag1.checked==true) save(); document.all.edit.focus(); document.execCommand(n,true); document.all.edit.focus(); if (n!="undo"&n!="redo") save(); } function checkRange() { document.all.edit.focus(); if (document.selection.type == "None") { document.selection.createRange(); } else save(); var r = document.selection.createRange(); } function sel(el) { save(); checkRange(); switch(el.id) { case "ctlFont": document.execCommand('FontName', false, el[el.selectedIndex].value); break; case "ctlSize": document.execCommand('FontSize', false, el[el.selectedIndex].value); break; } document.all.edit.focus(); div_reset(); }