gusucode.com > CRM源码带手机版ASP源码程序 > Skin/Default/TQEditor/TQEditor.with-plugs.min.js

    (function(e,j){if(e.TQE)return;var v="2.2.4",q=navigator.userAgent.toLowerCase(),b=e.document,f=!!e.ActiveXObject,g=f&&!e.XMLHttpRequest,w=f&&!!b.createDocumentFragment,n=q.indexOf("webkit")>=0,k=q.indexOf("presto")>=0,m=!n&&!k&&q.indexOf("gecko")>=0,J="\u6dfb\u52a0\u94fe\u63a5",r='<option value="">\u9ed8\u8ba4</option><option value="_blank">\u65b0\u7a97\u53e3</option><option value="_self">\u5f53\u524d\u7a97\u53e3</option><option value="_parent">\u7236\u7a97\u53e3</option><option value="_top">\u9876\u5c42\u7a97\u53e3</option>',D='\u7f51\u5740:<input type="text" id="url" value="" size=45 /><br />\u6807\u9898:<input type="text" id="title" value="" size=45 /><br />\u6253\u5f00:<select id="target">'+r+"</select>",G="\u63d2\u5165\u56fe\u7247",A='\u56fe\u7247\u7f51\u5740:<input type="text" id="url" value="" size=40 /><br />\u66ff\u6362\u6587\u672c:<input name="alt" type="text" id="alt" size="20" /><br />\u5c3a\u5bf8:<input name="width" type="text" id="width" size="4" /> &times; <input name="height" type="text" id="height" size="4" /> px &nbsp;<br />\u5bf9\u9f50:<select name="align" id="align"><option value="" >\u9ed8\u8ba4</option><option value="top">\u5c45\u4e0a</option><option value="textTop">\u6587\u672c\u4e0a\u65b9</option><option value="middle">\u5c45\u4e2d</option><option value="absMiddle">\u7edd\u5bf9\u5c45\u4e2d</option><option value="baseline">\u57fa\u7ebf</option><option value="bottom">\u5e95\u90e8</option><option value="absBottom">\u7edd\u5bf9\u5e95\u90e8</option><option value="left">\u5de6</option><option value="right">\u53f3</option></select> &nbsp; &nbsp; \u8fb9\u6846:<input name="border" type="text" id="border" size="5" />',x='<form class="ePopForm">\u7f51\u5740: <input type="text" id="url" size="50"><br>\u5c3a\u5bf8: <input  type="text" id="width" style="width:30px; overflow:visible;"> &times; <input  type="text" id="height" style="width:30px; overflow:visible;">px <a href="javascript:void(0)" id="resetWH" >\u91cd\u8bbe\u5927\u5c0f</a><label><input name="lock" type="checkbox" id="lock" value="1" checked>\u9501\u5b9a\u6bd4\u4f8b</label><br>\u66ff\u6362\u6587\u672c: <input type="text" id="alt" /> \u8fb9\u6846: <input type="text" id="border" style="width:30px; overflow:visible;" /><br>\u6392\u7248: <a href="javascript:void(0)" id="alignDefault">\u9ed8\u8ba4</a> | <a href="javascript:void(0)" id="alignLeft">\u5de6\u6d6e\u52a8</a> | <a href="javascript:void(0)" id="alignC">\u5c45\u4e2d</a> | <a href="javascript:void(0)" id="alignRight">\u53f3\u6d6e\u52a8</a> | <a href="javascript:void(0)" id="alignTop">\u4e0a\u5bf9\u9f50</a> | <a href="javascript:void(0)" id="alignAbsMiddle">\u4e2d\u5bf9\u9f50</a> | <a href="javascript:void(0)" id="alignBottom">\u4e0b\u5bf9\u9f50</a><div><hr>\u94fe\u63a5: <input type="text" id="link" size="40"><select id="target">'+r+"</select></div></form>",F="\u63d2\u5165\u52a8\u753b",z='Flash\u7f51\u5740:<input type="text" id="url" value="" size=40 /><br />\u5c3a\u5bf8:<input name="width" type="text" id="width" size="4" value="200" />&times;<input name="height" type="text" id="height" size="4" value="200" /> px',H="\u63d2\u5165\u97f3\u9891",B='\u97f3\u9891\u7f51\u5740:<input type="text" id="url" value="" size=40 /><br />\u81ea\u52a8\u64ad\u653e:<select id="auto_start" name="auto_start"><option value="0">\u624b\u52a8\u5f00\u59cb</option><option value="1">\u81ea\u52a8\u5f00\u59cb</option></select>',I="\u63d2\u5165\u89c6\u9891",C='\u89c6\u9891\u7f51\u5740:<input type="text" id="url" value="" size=40 /><br />\u5c3a\u5bf8:<input name="width" type="text" id="width" size="4"  value="320"/>&times;<input name="height" type="text" id="height" size="4" value="240" /> px<br />\u81ea\u52a8\u64ad\u653e:<select id="auto_start" name="auto_start"><option value="0">\u624b\u52a8\u5f00\u59cb</option><option value="1">\u81ea\u52a8\u5f00\u59cb</option></select><br />\u89c6\u9891\u7c7b\u578b:<select id="video_type" name="video_type"><option value="auto">\u81ea\u52a8\u8bc6\u522b</option><option value="flv">FLV</option><option value="rm">RMVB</option><option value="wm">\u5176\u4ed6\u89c6\u9891</option></select>',N="\u63d2\u5165\u884c",M="\u63d2\u5165\u5217",L="\u5220\u9664\u884c",K="\u5220\u9664\u5217",E="\u5220\u9664\u8868\u683c",y='<div><a class="eMenuItem" style="width:168px;" ><span id="eMergeCells" class="eButton"></span>\u5408\u5e76\u5355\u5143\u683c</a><a style="width:168px;" class="eMenuItem" ><span id="eSplitCells" class="eButton"></span>\u62c6\u5206\u5355\u5143\u683c</a><hr width="166"><div style="padding:1px 1px 1px 3px;">\u8868\u683c\u6392\u7248: <a id="eTableAlignLeft">\u5c45\u5de6</a> | <a id="eTableAlignCenter">\u5c45\u4e2d</a> | <a id="eTableAlignRight">\u5c45\u53f3</a></div><table border="0" cellSpacing="2" cellPadding="0"><tbody><tr><td width="65" align="center" valign="top" bgcolor="#FFFFFF" style="border:#999 solid 1px;">\u5185\u5bb9\u5bf9\u9f50<br><a id="eCellAlignLT" class="eButton eCellAlign"></a><a id="eCellAlignCT" class="eButton eCellAlign"></a><a id="eCellAlignRT" class="eButton eCellAlign"></a><br><a id="eCellAlignLC" class="eButton eCellAlign"></a><a id="eCellAlignCC" class="eButton eCellAlign"></a><a id="eCellAlignRC" class="eButton eCellAlign"></a><br><a id="eCellAlignLB" class="eButton eCellAlign"></a><a id="eCellAlignCB" class="eButton eCellAlign"></a><a id="eCellAlignRB" class="eButton eCellAlign"></a></td><td width="90" align="center" valign="top">\u5bbd\u5ea6<input id="width" name="width" size="3" type="text"><br>\u8fb9\u6846<input id="border" name="border" size="3" type="text"><br>\u95f4\u8ddd<input id="cellSpacing" name="cellSpacing" size="3" type="text"><br>\u586b\u5145<input id="cellPadding" name="cellPadding" size="3" type="text"></td></tr></tbody></table></div><div><hr width="166">\u63d2\u5165\u8868\u683c</div>',O="\u65e0\u8272",V="\u786e\u5b9a",S="\u53d6\u6d88",R="\u4e0a\u4f20",W="\u5173\u95ed",P="\u7248\u672c",Q="\u4f5c\u8005",U="\u5b98\u7f51",T="\u90ae\u7bb1",a=function(t,q){var l=this,o=a.clone(a.config);l.objId=t;if(q)for(var u in q)o[u]=q[u];if(typeof o.toolbar=="string"){var r=a.toolbarMode[o.toolbar];if(!r)r=a.toolbarMode.normal;o.toolbar=r.left;if(!q||j===q.toolbarRight)o.toolbarRight=r.right}l.config=o;l.hasFocus=false;l._containerDiv=null;l._toolbarDiv=null;l._clientDiv=null;l._statusDiv=null;l.init=function(){l.obj=a.find(l.objId);if(!l.obj){if(l.config.debug)throw"\u7f3a\u5c11ID\u4e3a "+l.objId+" \u8868\u5355\u5143\u7d20";return}if(l.obj.editor)return;l.obj.editor=l;if(!l.config.width||l.config.width=="auto")if(l.obj.style.width)l.config.width=l.obj.style.width;else if(l.obj.cols)l.config.width=l.obj.cols*8+"px";else l.config.width="100%";if(!l.config.height||o.height=="auto")if(l.obj.style.height)l.config.height=l.obj.style.height;else if(l.obj.rows)l.config.height=l.obj.rows*17+"px";else l.config.height="200";var c,j,m,d='<div class="eToolBar" id="'+l.objId+'_EditorToolBar">';if(l.config.toolbarRight.length){d+='<ul class="eToolBarGroupRight" >';for(c=0;c<l.config.toolbarRight.length;c++)d+=l._btnCode(l.config.toolbarRight[c],false);d+="</ul>"}d+='<ul class="eToolBarGroup" >';if(l.config.showToolbarGroupHandle){m=a.toolbarBottons.group;d+='<div class="eButton" id="eBTNgroup"  style="background-position: -'+m.left+"px 0;width:"+m.width+'px;" ></div>'}for(c=0;c<l.config.toolbar.length;c++)d+=l._btnCode(l.config.toolbar[c],true);d+='</ul><div class="eClear"></div></div><div id="'+l.objId+'_EditorClient" class="eEditorClient"><iframe id="'+l.objId+'_Editor" style="height:'+l.config.height+';" frameborder=0 ></iframe></div></div><div class="eStatusBar"><div class="eResizeWH" ></div><div class="eResizeH" ></div></div>';if(!l.config.debug)l.obj.style.display="none";var i=a.CE("DIV","TQEditorContainer_"+l.objId,d);i.className="eEditor";i.style.width=l.config.width;l.obj.parentNode.insertBefore(i,l.obj);l._containerDiv=i;l._toolbarDiv=a.find(l.objId+"_EditorToolBar");l._clientDiv=a.find(l.objId+"_EditorClient");a._noSel(l._toolbarDiv);var h=a._tags(l._toolbarDiv,"LI");for(c=h.length-1;c>=0;c--){l._ieMouseStyle(h[c],"eButton","eButtonUp","eButtonDown");a.addListener(h[c],"click",l._toolbarBottonClick);a.addListener(h[c],"mouseout",function(){var b=a.activePop;this.className=b&&b.relateObj==this?"eButtonDropDown":"eButton"})}if(f){var k=a._tags(l._toolbarDiv,"UL"),p;for(c=k.length-1;c>=0;c--){p=3;h=k[c].childNodes;for(j=h.length-1;j>=0;j--)p+=h[j].offsetWidth+2;k[c].style.minWidth=p+"px"}}"function"===typeof l.config.oninit&&l.config.oninit.call(l);l._initContent(l.obj.value);l.obj.focus=function(){this.editor.focus()};l._statusDiv=i.lastChild;if(false==l.config.resize)l._statusDiv.style.display="none";l._statusDiv.onmousedown=function(h){var m,o,k,d,i=this,c=a.pos(this),q=a._docScrollTop(),p=a._docScrollLeft(),r=parseInt(l.config.height,10),s=l._containerDiv.offsetWidth-2,j=this.style.cursor=="se-resize",v=a.pos(l._clientDiv).y,t=b.onmousemove,u=b.onmouseup;l._showTableContext(0);if(f){h=e.event;k=h.srcElement;m=p+h.clientX-c.x;o=q+h.clientY-c.y}else{k=h.target;m=h.pageX-c.x;o=h.pageY-c.y}j=j||k===i.firstChild;i.mouseout=i.onmouseleave=null;if(n||g){d=a.CE("DIV","","",true);d.className="eDragMaskDiv";d.style.cursor=j?"se-resize":"s-resize";d.style.height=Math.max(b.documentElement.clientHeight,b.body.scrollHeight)+"px"}if(i.setCapture)i.setCapture();else e.captureEvents&&e.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);b.onmousemove=function(b){if(f){b=e.event;b.pageX=p+b.clientX;b.pageY=q+b.clientY}var d=v-a.pos(l._clientDiv).y,h=Math.max(50-r+c.y-d,b.pageY-o),g=Math.max(100-s+c.x,b.pageX-m);j&&l.setWidth(g-c.x+s);l.setHeight(h-c.y+r+d)};b.onmouseup=function(){if(i.releaseCapture)i.releaseCapture();else e.releaseEvents&&e.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);b.onmousemove=t;b.onmouseup=u;d&&b.body.removeChild(d);d=null;l.focus();l._popTableContext()}}};l._btnCode=function(b,g){var f="",c,e,d;if("||"===b)b="group";else if("|"===b)b="separator";else if("string"!==typeof b){f='submenu="'+b.join(",")+'" ';b="submenu"}c=a.toolbarBottons[b];if(!c)return"";d=function(a){return'id="eBTN'+b+'" class="eButton"'+(a.css?' style="'+a.css+'"':"")};switch(b){case"group":if(!g)return"";e='</ul><ul class="eToolBarGroup" >';if(l.config.showToolbarGroupHandle)e+="<div "+d(c)+" ></div>";return e;case"separator":return"<div "+d(c)+" ></div>";default:return'<li name="'+b+'" title="'+c.text+'" '+f+d(c)+" ></li>"}};l._ieMouseStyle=function(c,e,d,h){if(!f||!g&&b.compatMode=="CSS1Compat")return;a.addListener(c,"mouseover",function(){this.className=d});a.addListener(c,"mouseup",function(){this.className=d});a.addListener(c,"mousedown",function(){this.className=h});a.addListener(c,"mouseout",function(){this.className=e})};l._keepBookmark=function(){if(f){var b,c=a.find(l.objId+"_Editor");a.addListener(c,"beforedeactivate",function(){b=l._getRange()});a.addListener(c,"activate",function(){if(null==b)return;var a=l._getSelection();if(a.addRange)a.addRange(b);else b.select();b=null})}};l._toolbarBottonClick=function(){var d=f?event:arguments[0],c=this.getAttribute("name"),b=a.toolbarBottons[c];d.cancelBubble=true;l.focus();if(b&&b.click)b.click(l,this);else{a.hidePop();l.exeCmd(c)}};l.__selectOption=function(b,c){for(var a=b.options.length-1;a>=0;a--)if(b.options[a].value==c){b.selectedIndex=a;return}};l.exeCmd=function(a,d){l.focus();var f=l.selectedCells(),c=l._getDoc(),b=l._getSelection(),e,g,h;if(f.length){g=c.createRange?c.createRange():c.body.createTextRange();for(e=0;e<f.length;e++){if("backcolor"==a||"hilitecolor"==a){f[e].style.backgroundColor=d;continue}if(b.empty)b.empty();else b.removeAllRanges&&b.removeAllRanges();if(b.selectAllChildren)b.selectAllChildren(f[e]);else if(g.moveToElementText){g.moveToElementText(f[e]);g.select()}try{c.execCommand(a,false,d!=null?d:false);if("bold"==a||"italic"==a||"underline"==a||"strikethrough"==a||"subscript"==a||"superscript"==a)if(e==0)h=c.queryCommandState(a);else h!=c.queryCommandState(a)&&c.execCommand(a,false,d!=null?d:false)}catch(i){}}if(b.empty)b.empty();else b.removeAllRanges&&b.removeAllRanges()}else try{return c.execCommand(a,false,d!=null?d:false)}catch(i){}};l.focus=function(){if(l.hasFocus)return;if("visual"==l.currentMode()){var c=l.selectedCells(),a,b;if(c.length<1){l._editorObj().contentWindow.focus();var a=l._getRange(),b=l._getSelection();if(n&&b.rangeCount<1){a.selectNodeContents(l._getDoc().body);a.collapse(true);b.removeAllRanges();b.addRange(a)}}else{var a=l._getRange();if(a.select){a.collapse(false);a.select()}else{a.selectNodeContents(c[0]);a.collapse(false);b=l._getSelection();b.removeAllRanges();b.addRange(a)}}}else l._editorObj().focus();l.hasFocus=true};l.focusNode=function(){if("visual"!==l.currentMode()||!l.hasFocus)return null;var a,b=l._getSelection().focusNode;if(!b){a=l._getRange();return a.length?a.item(0).parentNode:a.parentElement?a.parentElement():null}return b};l._showColorSelectUI=function(d,c){var b=a.find(l.objId+"ColorSelect"+c);if(null==b){b=a.CE("DIV",l.objId+"ColorSelect"+c,a._colorPickerUI(),true);b.className="ePopPanel";a._noSel(b);a.listenTags(b,"TD","click",function(){a.hidePop();l.exeCmd(c,this.bgColor)});b.lastChild.lastChild.onclick=function(){a.hidePop();l.exeCmd(c,"")};a.listenTags(b,"TD","mouseover",function(){var a=this,c=e.setInterval(function(){a.style.backgroundColor=a.style.backgroundColor!=""?"":"#FFFFFF"},500),b=this.parentNode.parentNode.parentNode.parentNode.lastChild;b.firstChild.style.backgroundColor=this.bgColor;b.firstChild.nextSibling.innerHTML=this.bgColor;this.style.backgroundColor="#FFFFFF";this.onmouseout=function(){e.clearInterval(c);this.style.backgroundColor=""}})}a.pop(b,d)};l._popAsMenu=function(i,j){var m=i.getAttribute("name"),b=a.find(l.objId+"PopMenu"+m),h="",f,c,d,e;if(null==b){b=a.CE("DIV",l.objId+"PopMenu"+m,"",true);b.className="ePopPanel"}for(c=0;c<j.length;c++){d=j[c];if("separator"==d||"|"==d){h+='<hr style="width:120px; clear:both;" />';continue}e=a.toolbarBottons[d];if(e)h+='<div  name="'+d+'" class="eMenuItem" ><span class="eButton" id="eBTN'+d+'" ></span>'+e.text+"</div>"}b.innerHTML=h;a._noSel(b);k&&a._noSel(b,"DIV");a.listenTags(b,"DIV","click",l._toolbarBottonClick);if(g){f=a._tags(b,"DIV");for(c=f.length-1;c>=0;c--)l._ieMouseStyle(f[c],"eMenuItem","eMenuItemUp","eMenuItem")}a.pop(b,i)};l._popFormUI=function(u,r,t,s,e,b,o,p,q){var c='<form class="ePopForm">';if(b){c+='<div class="eTabBar"><a href="javascript:void(0)" class="active" HIDEFOCUS="true">'+r+'</a><a href="javascript:void(0)" HIDEFOCUS="true">'+R+"</a></div>";c+="<div>"}c+=t;c+='<div class="eBar"><button id="OK" name="OK" type="submit" class="eBtn"  HIDEFOCUS="true"/>'+V+'</button> &nbsp; <button id="Cancel" name="Cancel" type="button" class="eBtn"  HIDEFOCUS="true">'+S+"</button></div>";if(b){c+='</div><div style="display:none">';var f=b;if(b.substr(0,1)=="#")f=b.substring(1);else{if(!("http://"==b.substr(0,7).toLowerCase()||"/"==b.substr(0,1)||"https://"==b.substr(0,6).toLowerCase()))if("?"==b.substr(0,1))b=location.pathname+b;else{var h=location.pathname.split("/");h[h.length-1]=b;b=h.join("/")}f=a.url+"upload.htm?url="+encodeURIComponent(b)+"&field_name="+l.config.uploadFieldName+"&exts="+encodeURIComponent(o)+"&max_size="+encodeURIComponent(p)+"&debug="+l.config.debug+"&upload_type="+q}c+='<iframe src="'+f+'" frameborder=0 width=358 height=45 ALLOWTRANSPARENCY=true marginwidth=0 marginheight=0 ></iframe>';c+="</div>"}c+="</form>";var d=a.CE("DIV",u,c,true);d.className="ePopPanel";if(b){var m=function(){this.className="active";var a=this.parentNode.nextSibling;if(this.nextSibling){this.nextSibling.className="";a.style.display="";a.nextSibling.style.display="none";a.parentNode.getElementsByTagName("INPUT")[0].focus()}else if(this.previousSibling){this.previousSibling.className="";a.style.display="none";a.nextSibling.style.display=""}},n=d.firstChild.firstChild;n.firstChild.onclick=m;n.lastChild.onclick=m}var j=a._tags(d,"FORM")[0],g=j.elements;j.srcEditor=l;g.Cancel.onclick=a.hidePop;g.OK.onclick=s;j.onsubmit=function(){this.elements.OK.click();return false};if(e)for(i=e.length-1;i>=0;i--)l._intEdit(g[e[i]]);a._noSel(d);k&&a._noSel(d,"FORM,DIV");return d};l.insertMusic=function(b,a){var c=l.config.tplMusic.replace(/\{\$url\}/g,b).replace(/\{\$auto_start\}/g,a);l.insertHtml(c)};l.insertFlash=function(d,c,b){var a=l.config.tplFlash.replace(/\{\$url\}/g,d);a=a.replace(/\{\$width\}/g,c);a=a.replace(/\{\$height\}/g,b);l.insertHtml(a)};l.insertVideo=function(c,d,g,f,e){var a="",b;switch(e){case"rm":a=l.config.tplRm;break;case"flv":a=l.config.tplFlv;break;case"wm":a=l.config.tplVideo;break;default:b=c.substr(c.lastIndexOf(".")).toLowerCase();if(".flv"==b)a=l.config.tplFlv;else if(".rm"==b||".rmvb"==b)a=l.config.tplRm;else a=l.config.tplVideo}a=a.replace(/\{\$url\}/g,c).replace(/\{\$auto_start\}/g,d).replace(/\{\$width\}/g,g).replace(/\{\$height\}/g,f);l.insertHtml(a)};l.insertHtml=function(e,d){l.focus();if("code"==l.currentMode()){var f=l._editorObj();if(b.selection){var c=b.selection.createRange();if("before"==d||-1==d)c.text=e+c.text;else if("after"==d||1==d)c.text+=e;else c.text=e;c.select()}else if(f.selectionStart||f.selectionStart=="0"){var j=f.selectionStart,k=f.selectionEnd,p=f.scrollTop,h=f.value;if("before"==d||-1==d)e=h.substring(j,k)+e;else if("after"==d||1==d)e+=h.substring(j,k);f.value=h.substr(0,j)+e+h.substr(k,h.length);f.focus();f.selectionStart=f.selectionEnd=j+e.length;f.scrollTop=p}else{f.value+=e;f.focus()}l.save();return}if(m)e=e.replace(/<td([^>]*)>\s*<\/td/ig,"<td$1 ><br></td");var c=l._getRange();if(c.length){var q=l._getDoc(),r=c.item(0),i=q.body.createTextRange();i.moveToElementText(r);if("before"==d||-1==d)i.collapse();else if("after"==d||1==d)i.collapse(false);else c.execCommand("Delete");i.pasteHTML(e);i.select()}else if(c.insertNode){var g,o,n;if(c.createContextualFragment)g=c.createContextualFragment(e);else{g=l._getDoc().createDocumentFragment();g.appendChild(a.CE("div"));g.firstChild.outerHTML=e}if("before"==d||-1==d){o=g.lastChild;c.insertNode(g);c.setEndAfter(o)}else if("after"==d||1==d){c.collapse(false);c.insertNode(g)}else{c.deleteContents();c.insertNode(g)}c.collapse(false);n=l._getSelection();n.removeAllRanges();n.addRange(c)}else{if("before"==d||-1==d)c.collapse(true);else("after"==d||1==d)&&c.collapse(false);c.pasteHTML(e);c.collapse(false);c.select()}l.save()};l.appendHtml=function(a){l.unselectAllCells();l.setContent(l.content()+a)};l._editorObj=function(){return a.find(l.objId+"_Editor")};l.currentMode=function(){return l._editorObj().tagName.toUpperCase()==="IFRAME"?"visual":"code"};l._getDoc=function(){var a=l._editorObj();return a.contentDocument||a.contentWindow.document};l._getSelection=function(){var a=l._editorObj().contentWindow;return a.getSelection?a.getSelection():l._getDoc().selection};l._getRange=function(){var a=l._getSelection(),c=l._getDoc(),b;try{b=a.rangeCount>0?a.getRangeAt(0):a.createRange?a.createRange():c.createRange()}catch(d){}if(!b)b=f?c.body.createTextRange():c.createRange();return b};l.insertImage=function(g,c,b,d,f,e){if(""==g)return;var a='<img src="'+g+'" ';if(c!==j&&""!=c&&!isNaN(parseInt(c))&&parseInt(c)>0)a+=" width="+parseInt(c);if(b!==j&&""!=b&&!isNaN(parseInt(b))&&parseInt(b)>0)a+=" height="+parseInt(b);if(d!==j&&""!=d&&!isNaN(parseInt(d)))a+=" border="+parseInt(d);if(f!==j&&""!=f)a+=' alt="'+f+'"';if(e!==j&&""!=e)a+=' align="'+e+'"';a+=" />";l.insertHtml(a);return};l._enableButton=function(b,c){if(c){b.disabled=false;l.setOpacity(b,100);a.addListener(b,"click",l._toolbarBottonClick)}else{b.disabled=true;l.setOpacity(b,30);a.delListener(b,"click",l._toolbarBottonClick)}};l._updateToolbar=function(f,e,d){for(var g=l._toolbarDiv,c=a._tags(g,"LI"),b=c.length-1;b>=0;b--)l.inArray(c[b].getAttribute("name"),e)^d&&l._enableButton(c[b],f)};l._hook=function(){var c=l._getDoc();c.onkeydown=function(g){a._hideContext();if(f)g=l._realEvent(g);var h=g.keyCode||g.which;g.ctrlKey&&(13==h||10==h||83==h)&&l.save();var o=l._call("keydown",g);if(j!==o&&false==o)return false;(8==h||46==h)&&l.selectedCells().length&&l.exeCmd("delete");if(h==13){var c=l.focusNode(),m,i,e,n;if(!c)return;if(c.nodeName==="#text")c=c.parentNode;if(c.className=="splitPage"){m=c.parentNode;if(c.nextSibling&&c.nextSibling.nodeName==="BR")i=c.nextSibling;else{i=b.createElement("BR");if(m.lastChild==c)m.appendChild(i);else m.insertBefore(i,c.nextSibling)}n=l._getDoc();if(f){e=n.body.createTextRange();e.moveToElementText(i);e.collapse(true);e.select()}else{e=n.createRange();e.selectNode(i);e.collapse(true);var p=l._getSelection();p.removeAllRanges();p.addRange(e)}return false}if(l.config.enter2br){if(c.tagName!="LI"){l.insertHtml("<br />");return false}}else if(!f&&!g.shiftKey){for(var o=l._getRange(),d,k=o.startContainer;k;k=k.parentNode){d=k.nodeName;if(d=="LI"||d=="P"||"H1"==d||"H2"==d||"H3"==d||"H4"==d||"H5"==d||"H6"==d||"DIV"==d)return true}l.exeCmd("FormatBlock","p")}}};c.onkeyup=function(b){b=l._realEvent(b);var e=b.keyCode||b.which,d=this.body.firstChild;if((8===e||46===e)&&d&&d===c.body.lastChild){var a=d.nodeName,f=d.innerHTML,g=/^<(strong|em|b|i|u|font)[^>]*><\/\1>|&nbsp;$/i;if(a==="P"||a==="H1"||a==="H2"||a==="H3"||a==="H4"||a==="H5"||a==="H6"||a==="BR")if(""===f||g.test(f))c.body.innerHTML=""}l._call("keyup",b)};c.ondragstart=function(){a._hideContext();l._showTableContext(0)};c.onclick=function(c){var b,e,d;a._hideContext();if(!f){b=c.target;if("IMG"===b.nodeName){e=l._getDoc().createRange();d=l._getSelection();e.selectNode(c.target);d.removeAllRanges();d.addRange(e);l._popImagePanel(b)}}else{c=l._realEvent(c);b=c.srcElement;"IMG"===b.nodeName&&l._popImagePanel(b)}};if(f){c.onmousedown=c.onclick;c.onclick=null}if(l.config.autoClean)c.body.onpaste=function(){setTimeout(l.cleanWord,200)};a.addListener(c,"mouseup",a.hidePop);a.addListener(c,"scroll",l._popTableContext);a.addListener(c.body,"scroll",l._popTableContext);a.addListener(c,"keyup",l._popTableContext);a.addListener(c,"mouseup",l._popTableContext);a.addListener(c,"mousedown",l._startSelectTd);a.addListener(c,"keypress",l.unselectAllCells);if(g){a.addListener(c,"mouseup",l.focus);a.addListener(c,"mousedown",l.focus)}};l._popImagePanel=function(c){var b=a.find("__tqImagePanel");if(null==b){b=a.CE("DIV","__tqImagePanel",x,true);b.className="ePopPanel";var j=a._tags(b,"FORM")[0],d=j.elements;l._intEdit(d.width);l._intEdit(d.height);l._intEdit(d.border);b.urlField=d.url;b.widthField=d.width;b.heightField=d.height;b.lockField=d.lock;b.borderField=d.border;b.altField=d.alt;b.linkField=d.link;b.targetField=d.target;b.linkField.onchange=function(){var c=this.parentNode.parentNode.parentNode,b=c.target,a=b.parentNode;if(a.nodeName!=="A")return;a.setAttribute("href",this.value)};b.targetField.onchange=function(){var c=this.parentNode.parentNode.parentNode,b=c.target,a=b.parentNode;if(a.nodeName!=="A")return;a.setAttribute("target",this.options[this.selectedIndex].value)};b.urlField.onchange=function(){this.parentNode.parentNode.target.src=this.value};b.urlField.onfocus=function(){this.select()};var i=function(){var a=this.parentNode.parentNode,b=a.target,c=h=Math.max(1,this.value);if(a.lockField.checked)if(this.id=="width")h=a.heightField.value=Math.round(c/a.rate);else c=a.widthField.value=Math.round(h*a.rate);else if(this.id=="width")h=a.heightField.value;else c=a.widthField.value;b.width=c;b.height=h;b.style.width="";b.style.height=""};b.widthField.onchange=b.widthField.onblur=b.heightField.onchange=b.heightField.onblur=i;b.borderField.onchange=function(){var a=this.parentNode.parentNode.target;if(""===this.value)a.removeAttribute("border");else a.border=this.value};b.altField.onchange=function(){var a=this.parentNode.parentNode.target;if(""===this.value)a.removeAttribute("alt");else a.alt=this.value};b.lockField.onclick=function(){if(this.checked){var a=this.parentNode.parentNode.parentNode;a.rate=a.widthField.value/a.heightField.value}};for(var g=function(){var c=this.parentNode.parentNode,a=c.target,b=this.id;if("resetWH"==b){a.removeAttribute("width");a.removeAttribute("height");a.style.width="";a.style.height="";c.widthField.value=a.width;c.heightField.value=a.height;c.rate=a.width/a.height}else{a.align="";a.style.display="";a.style.margin="";l.exeCmd("justifynone");if("alignC"==b)l.exeCmd("justifycenter");else if("alignDefault"!=b)a.align=b.substring(5,20).toLowerCase()}return false},f=a._tags(b,"A"),e=f.length-1;e>=0;e--)f[e].onclick=g;a._noSel(b)}if(c.parentNode&&c.parentNode.nodeName==="A"){b.lastChild.lastChild.style.display="";b.linkField.value=c.parentNode.getAttribute("href");l.__selectOption(b.targetField,c.parentNode.getAttribute("target"))}else{b.lastChild.lastChild.style.display="none";b.linkField.value="";b.targetField.selectedIndex=0}b.target=c;b.urlField.value=c.getAttribute("src");b.widthField.value=c.width;b.heightField.value=c.height;b.borderField.value=c.border;b.altField.value=c.alt;b.rate=c.width>0&&c.height>0?c.width/c.height:1;l._popContext(b,c)};l._popContext=function(b,g){a.activeContext!=b&&a._hideContext();var f,c,e;p=a.pos(l._editorObj()),p2=g.getBoundingClientRect(),d=a._doc();b.style.display="block";f=Math.min(p.x+p2.left,a._docScrollLeft()+d.clientWidth-b.offsetWidth-5);c=10+p.y+p2.bottom;e=a._docScrollTop()+d.clientHeight-b.offsetHeight-10;if(c>e)c=p2.top+p.y-b.offsetHeight-10;if(c<a._docScrollTop())c=10+Math.max(p.y,a._docScrollTop());b.style.left=f+"px";b.style.top=c+"px";a.activeContext=b;a.drag(b)};l._showTableContext=function(e){for(var b,d=["TQEAddRowBefore","TQEAddRowAfter","TQEAddColBefore","TQEAddColAfter","TQEDeleteRow","TQEDeleteColumn","TQEDeleteTable"],c=d.length;c>=0;c--){b=a.find(d[c]);if(b)b.style.display=e?"":"none"}};l._popTableContext=function(){var m,b=l.focusNode();while(b&&b.nodeName!=="TD")b=b.parentNode;if(!b)return l._showTableContext(0);m=b.parentNode.parentNode.parentNode;var k=a.pos(l._editorObj()),p=m.getBoundingClientRect(),e=b.getBoundingClientRect(),c=a.find("TQEAddRowBefore"),h=a.find("TQEAddRowAfter"),f=a.find("TQEAddColBefore"),d=a.find("TQEAddColAfter"),j=a.find("TQEDeleteRow"),g=a.find("TQEDeleteColumn"),i=a.find("TQEDeleteTable"),q=l._getDoc().documentElement,n,o;if(e.top+b.offsetHeight<0||e.left+b.offsetWidth<0||e.top>=q.clientHeight||e.left>=q.clientWidth)return l._showTableContext(0);if(!c){i=a.CE("A","TQEDeleteTable","",true);i.title=E;c=a.CE("A","TQEAddRowBefore","",true);h=a.CE("A","TQEAddRowAfter","",true);h.className=c.className="eButtonAddRow";c.title=h.title=N;f=a.CE("A","TQEAddColBefore","",true);d=a.CE("A","TQEAddColAfter","",true);d.className=f.className="eButtonAddCol";f.title=d.title=M;j=a.CE("A","TQEDeleteRow","",true);g=a.CE("A","TQEDeleteColumn","",true);g.className=j.className=i.className="eButtonDeleteRC";j.title=L;g.title=K;a._noSel(c);a._noSel(h);a._noSel(f);a._noSel(d);a._noSel(j);a._noSel(g);a._noSel(i);c.onclick=h.onclick=f.onclick=d.onclick=j.onclick=g.onclick=i.onclick=function(){if(!this.cell)return;var b=this.cell,d=b.parentNode.parentNode.parentNode,c=this.editor;c.unselectAllCells();switch(this.id){case"TQEAddRowBefore":a.insertRow(b,1);break;case"TQEAddRowAfter":a.insertRow(b,0);break;case"TQEAddColBefore":a.insertCol(b,1);break;case"TQEAddColAfter":a.insertCol(b,0);break;case"TQEDeleteRow":a.deleteRow(b);break;case"TQEDeleteColumn":a.deleteCol(b);break;case"TQEDeleteTable":d.parentNode.removeChild(d)}c.focus();c._popTableContext()}}else l._showTableContext(1);c.cell=h.cell=f.cell=d.cell=j.cell=g.cell=i.cell=b;c.editor=h.editor=f.editor=d.editor=j.editor=g.editor=i.editor=l;h.style.left=c.style.left=j.style.left=Math.min(k.x+l._getDoc().body.offsetWidth-12,k.x+p.left+m.offsetWidth)+"px";c.style.top=k.y+e.top-5+"px";h.style.top=k.y+e.top+b.offsetHeight-4+"px";j.style.top=k.y+e.top+(b.offsetHeight>>>1)-6+"px";d.style.top=f.style.top=g.style.top=k.y+Math.max(0,p.top-12)+"px";f.style.left=k.x+e.left-5+"px";d.style.left=k.x+e.left+b.offsetWidth-5+"px";g.style.left=k.x+e.left+(b.offsetWidth>>1)-6+"px";n=a.pos(c);o=a.pos(d);i.style.top=Math.min(o.y,n.y-13)+"px";i.style.left=Math.max(o.x+10,n.x)+"px"};l.activeTable=null;l.unselectAllCells=function(){if(!l.activeTable)return;for(var d=l.activeTable,c,b=d.rows.length-1;b>=0;b--)for(c=d.rows[b].cells.length-1;c>=0;c--){td=d.rows[b].cells[c];p=a.pos(td);l._selectCell(td,false)}l.activeTable=null};l.selectedCells=function(){if(!l.activeTable)return[];for(var c=l.activeTable,b,d=[],a=c.rows.length-1;a>=0;a--)for(b=c.rows[a].cells.length-1;b>=0;b--)c.rows[a].cells[b].isSelected&&d.push(c.rows[a].cells[b]);return d};l._selectCell=function(a,b){if(a.isSelected==b)return;a.className=b?"selectedTD":"";a.isSelected=b};l._pos=function(d){var e=0,f=0,g=d.getBoundingClientRect(),c=l._getDoc(),b=l._editorObj().contentWindow,a=c.compatMode!="CSS1Compat"?c.body:c.documentElement;e=g.left-a.clientLeft+(b.scrollX?b.scrollX:a.scrollLeft);f=g.top-a.clientTop+(b.scrollY?b.scrollY:a.scrollTop);return{x:e,y:f,left:e,top:f,width:d.offsetWidth,height:d.offsetHeight}};l._startSelectTd=function(c){var u,v,k,m,h,t,s,r,g,d,i=false,a=l._getDoc(),e=a.parentWindow,j=a.compatMode!="CSS1Compat"?a.body:a.documentElement,p=a.onmousemove,q=a.onmouseup,o=a.ondragstart,n=b.onmouseup;c=l._realEvent(c);if(c.ctrlKey||c.altKey||c.button!=f?1:0)return;l.unselectAllCells();d=f?c.srcElement:c.target;while(d&&d.nodeName!="BODY"&&d.nodeName!="TD")d=d.parentNode;if(!d||d.nodeName!=="TD")return;h=d.parentNode.parentNode.parentNode;g=l._pos(d);k=f?c.clientX+(e.scrollX?e.scrollX:j.scrollLeft):c.pageX;m=f?c.clientY+(e.scrollY?e.scrollY:j.scrollTop):c.pageY;a.onmousemove=function(d){var b,c,v,w,o,p,r,s,t,u,a,q,n;if(f){d=this.parentWindow.event;b=d.clientX+(e.scrollX?e.scrollX:j.scrollLeft);c=d.clientY+(e.scrollY?e.scrollY:j.scrollTop)}else{b=d.pageX;c=d.pageY}if(!i&&(b<g.x||b>g.x+g.width||c<g.y||c>g.y+g.height)){i=true;l.activeTable=h}if(!i)return;n=l._getSelection();if(n.empty)n.empty();else n.removeAllRanges&&n.removeAllRanges();r=Math.min(k,b);s=Math.max(k,b);t=Math.min(m,c);u=Math.max(m,c);for(o=h.rows.length-1;o>=0;o--)for(p=h.rows[o].cells.length-1;p>=0;p--){q=h.rows[o].cells[p];a=l._pos(q);l._selectCell(q,a.x<=s&&a.y<=u&&a.x+a.width>=r&&a.y+a.height>t)}};a.ondragstart=a.onmouseup=b.onmouseup=function(){a.onmousemove=p;a.ondragstart=o,b.onmouseup=n;i=false}};l.canMergeSelectedCells=function(){if(!l.activeTable)return false;var f=l.activeTable,b,g,h,j,i,e,m,d,k=0,c=l.selectedCells();if(c.length<2)return false;a.updateCellsStatus(f);h=c[0].colStart;i=c[0].colEnd;j=c[0].rowStart;e=c[0].rowEnd;for(b=c.length-1;b>0;b--){h=Math.min(h,c[b].colStart);j=Math.min(j,c[b].rowStart);i=Math.max(i,c[b].colEnd);e=Math.max(e,c[b].rowEnd)}for(b=Math.min(e,f.rows.length-1);b>=0;b--)for(g=f.rows[b].cells.length-1;g>=0;g--){d=f.rows[b].cells[g];if(!d.isSelected&&d.colStart<=i&&d.colEnd>=h&&d.rowStart<=e&&d.rowEnd>=j)return false}return true};l.mergeSelectedCells=function(){if(!l.canMergeSelectedCells())return false;for(var g=l.activeTable,e,j,m,b,k="",f=null,i=1,h=1,c,d=0;d<g.rows.length;d++)for(e=0;e<g.rows[d].cells.length;e++)if(g.rows[d].cells[e].isSelected){c=g.rows[d].cells[e];k+=c.innerHTML;b=a.pos(c);if(f===null){f=c;j=b.x;m=b.y;i=f.rowSpan;h=f.colSpan}else{if(b.y===m)h+=c.colSpan;else if(b.x===j)i+=c.rowSpan;c.innerHTML=""}}f.innerHTML=k.replace(/(&nbsp;|<br\s*\/?>)+$/,"$1");f.rowSpan=i;f.colSpan=h;for(d=g.rows.length-1;d>=0;d--){b=g.rows[d];for(e=b.cells.length-1;e>=0;e--)if(b.cells[e].isSelected){c=b.cells[e];c!=f&&b.removeChild(c)}b.cells.length<1&&g.deleteRow(d)}a.updateCellsStatus(g)};l.splitCell=function(b){if(!b||b.rowSpan<2&&b.colSpan<2)return true;var h=b.parentNode.parentNode.parentNode,c,d,g,e,f;a.updateCellsStatus(h);for(c=b.rowStart;c<=b.rowEnd;c++){e=h.rows[c];for(d=0;d<e.cells.length;d++)if(e.cells[d].colStart>b.colEnd)break;g=b.colSpan;if(c==b.rowStart)g--;while(0<g--){f=e.insertCell(d);l._selectCell(f,b.isSelected);f.style.backgroundColor=b.style.backgroundColor}}b.rowSpan=1;b.colSpan=1};l._changed=function(){l._autoSave(1);l._showTableContext(false);var b;if("visual"===l.currentMode()){l._keepBookmark();l._hook();b=l._editorObj().contentWindow;a.addListener(b,"resize",l._popTableContext);if(g)b=b.document.body}else{b=l._editorObj();a.addListener(b,"mouseup",a.hidePop);b.onkeydown=function(a){return l._call("keydown",a)};b.onkeyup=function(a){return l._call("keyup",a)}}b.onfocus=function(a){l.hasFocus=true;l.obj.onfocus&&l.obj.onfocus();l._call("focus",a)};b.onblur=function(a){l.hasFocus=false;l.obj.onblur&&l.obj.onblur();l._call("blur",a)}};l._realEvent=function(a){if(f)a="code"===l.currentMode()?e.event:l._editorObj().contentWindow.event;return a};l._call=function(b,c){var a=l.config["on"+b];if("function"===typeof a)return a.call(l,l._realEvent(c))};l.changeMode=function(b){var e=l.currentMode();if(e===b)return;if(!b)b="code"!=e?"code":"visual";if(b==e)return;l.hasFocus=false;var i=l._editorObj(),g=l._button("mode"),f=i.offsetHeight,d,c="visual"===b;if("code"===b){l.unselectAllCells();f-=4;d='<table width=100% border=0 cellpadding=0 cellspacing=0><tr><td width=2></td><td><textarea id="'+l.objId+'_Editor" wrap="hard" style="height:'+f+'px"></textarea></td></tr></table>'}else if(c)d='<IFRAME id="'+l.objId+'_Editor" frameborder=0 marginheight=0 marginwidth=0 style="height:'+f+'px" ></IFRAME>';else return;l._autoSave(0);a._hideContext();var h=l.content();l._clientDiv.innerHTML=d;l._initContent(h);if(g)g.id=c?"eBTNmode":"eBTNmode-reset";l._updateToolbar(c,["mode","fullscreen","help"],true)};l.typeset=function(){if("visual"!=l.currentMode())return;l._showTableContext(0);var g=l._getDoc(),b,d,h,f,e,k;h=g.body.innerHTML;h=h.replace(/&nbsp;/gi," ").replace(/>\s+</gm,"> <").replace(/ +/gi," ").replace(/<div/gi,"<p").replace(/<\/div/gi,"</p");g.body.innerHTML=h;d=a._tags(g,"CENTER");for(i=d.length-1;i>=0;i--)a.removeNode(d[i],false);d=a._tags(g,"SPAN");for(i=d.length-1;i>=0;i--){b=d[i];k=b.style.fontWeight,c=b.style.color;if(""===b.innerHTML.replace(/<[a-z\/][^>]*>/gi,"")||k==""&&c==""){a.removeNode(b,false);continue}b.removeAttribute("style");b.className="";b.removeAttribute("class");b.style.fontWeight=k;b.style.color=c}d=a._tags(g,"H3");for(i=d.length-1;i>=0;i--)if(d[i].className==="splitPage")d[i].innerHTML=d[i].innerHTML.replace(/<\/?[a-zA-z][^>]*>/g,"");d=a._tags(g,"P");var n=/^(&nbsp;| ){3,}/;for(i=d.length-1;i>=0;i--){b=d[i];if(""==b.innerHTML.replace(/<[a-z\/][^>]*>/gi,"").replace(/( |\n|\r|\t|&nbsp;)/gi,"")){a.removeNode(b,false);continue}b.removeAttribute("style");b.className="";b.removeAttribute("class");if(n.test(b.innerHTML))b.align="center";else{b.removeAttribute("align");b.style.textIndent=l.config.typesetIndentParagraph?"2em":""}}d=a._tags(g,"A");for(i=d.length-1;i>=0;i--){b=d[i];if(""==b.innerHTML.replace(/<[a-z\/][^>]*>/gi,"").replace(/( |\n|\r|\t|&nbsp;)/gi,"")){a.removeNode(b,false);continue}b.removeAttribute("style");b.className="";b.removeAttribute("class")}var m=function(a){var b=a.nodeName,c=/^( |\n|\r|\t|&nbsp;)*$/gi;return b==="#text"?c.test(a.nodeValue):"BR"===b||"IMG"!==b&&""==a.innerHTML.replace(/<[a-z\/][^>]*>/gi,"").replace(/(\s|&nbsp;)/gmi,"")},j=function(c){var b,d;while(c&&c.tagName!="BODY"){b=c;while(b=b.nextSibling){if(m(b))continue;if(b.nodeName==="#text"){f=a.CE("CENTER","",b.nodeValue);c.parentNode.insertBefore(f,b);a.removeNode(b,true);return}else{if(b.tagName=="CENTER")return;if(b.tagName=="P")b.align="center";else b.style.textAlign="center";return}}c=c.parentNode}};d=a._tags(g,"IMG");for(i=d.length-1;i>=0;i--){b=d[i];if(b.getAttribute("emot"))continue;l.config.typesetImageTextCenter&&j(b);b.removeAttribute("style");b.border=l.config.typesetImageBorder?"1":"0";b.style.margin="5px";e=b.parentNode;if(e.tagName=="A"&&e.firstChild==e.lastChild){b=e;e=e.parentNode}if(e.tagName=="P"&&e.align=="center"||e.tagName=="CENTER"||e.style.textAlign=="center")continue;f=a.CE("CENTER");e.insertBefore(f,b);f.appendChild(b)}d=a._tags(g,"OBJECT");for(i=d.length-1;i>=0;i--){b=d[i];l.config.typesetImageTextCenter&&j(b);e=b.parentNode;if(e.tagName=="P"&&e.align=="center"||e.tagName=="CENTER"||e.style.textAlign=="center")continue;f=a.CE("CENTER");e.insertBefore(f,b);f.appendChild(b)}d=a._tags(g,"EMBED");for(i=d.length-1;i>=0;i--){b=d[i];if("OBJECT"===b.parentNode.tagName)continue;l.config.typesetImageTextCenter&&j(b);e=b.parentNode;if(e.tagName=="P"&&e.align=="center"||e.tagName=="CENTER"||e.style.textAlign=="center")continue;f=a.CE("CENTER");e.insertBefore(f,b);f.appendChild(b)}l.cleanWord(true)};l.cleanWord=function(d){if("visual"!=l.currentMode())return;var b=l._getDoc();if(!d)if(b.body.innerHTML.indexOf("mso")<0)return;var c=function(h,g){for(var d,f,c,e=h.length-1;e>=0;e--){f=a._tags(b,h[e]);for(e=f.length-1;e>=0;e--){d=f[e];d.removeAttribute("lang");c=d.getAttribute("style");if(null==c&&g){a.removeNode(d,false);continue}if(typeof c=="string"&&c.indexOf("mso-")>=0){c+=";";c=c.replace(/mso\-[^;]+?;/gi,"").replace(/FONT\-FAMILY[^;]+?;/gi,"").replace(/\s+/g," ").replace(/MARGIN\: 0cm 0cm 0pt/gi,"");if(""==c||" "==c){if(g){a.removeNode(d,false);continue}d.removeAttribute("style")}else d.setAttribute("style",c)}c=d.getAttribute("class");if(null!=c){c=c.replace(/mso[a-z\-]+\s*/gi,"");if(""==c)d.removeAttribute("class");else d.setAttribute("class",c)}}}};c(["SPAN"],true);c(["P","B","I","U","TD","TR","TABLE","DIV"],true);b.body.innerHTML=b.body.innerHTML.replace(/<o:[a-z0-9_]+[^>]*>/gi,"").replace(/<\/o:[a-z0-9_]+>/gi,"").replace(/<\?xml.+?\/>/gi,"");l.save()};l.setWidth=function(a){if(a>1)l.config.width=a+"px";else l.config.width=a*100+"%";l._containerDiv.style.width=l.config.width};l.setHeight=function(a){if(a<9)a=9;l.config.height=a+"px";l._setHeight(a)};l._setHeight=function(a){if(a<2)a=2;l._editorObj().style.height=a+"px";if("visual"==l.currentMode()){a-=6;if(a<2)a=2;l._getDoc().body.style.minHeight=a+"px";if(g)l._getDoc().body.style.height=a+"px"}};l._fixFull=function(){var c=a._doc(),b=l._containerDiv,d;b.style.zIndex="10000";b.style.width=c.clientWidth-2+"px";b.style.top=a._docScrollTop()+"px";b.style.left=a._docScrollLeft()+"px";d=c.clientHeight-l._toolbarDiv.offsetHeight;l._setHeight(d-("visual"==l.currentMode()?2:6))};l._button=function(d){for(var c=a._tags(l._toolbarDiv,"LI"),b=c.length-1;b>=0;b--)if(d==c[b].getAttribute("name"))return c[b];return null};l.fullScreen=function(d){var c=l._containerDiv,f="visual"===l.currentMode(),h,g;if(d===j||null===d)d=c.style.position!="absolute";else if(d==(ec.style.position=="absolute"))return;f&&l.changeMode("code");if(d){b.body.parentNode.style.overflow="hidden";b.body.appendChild(c);if(f)if(m)e.setTimeout(function(){l.changeMode("visual")},1);else l.changeMode("visual");c.style.position="absolute";c.style.top="0px";l._fixFull();a.addListener(e,"resize",l._fixFull)}else{b.body.parentNode.style.overflow="auto";a.delListener(e,"resize",l._fixFull);c.style.position="";c.style.width=l.config.width;h=l._editorObj();h.style.height=l.config.height;l.obj.parentNode.insertBefore(c,l.obj);f&&l.changeMode("visual");c.scrollIntoView(false)}g=l._button("fullscreen");if(g)g.id=d?"eBTNfullscreen-reset":"eBTNfullscreen"};l.setContent=function(a){if("code"===l.currentMode())return l._editorObj().value=a;if("function"===typeof l.config.onsetcontent)a=l.config.onsetcontent.call(l,a);l._getDoc().body.innerHTML=a};l._initContent=function(b){if("code"!==l.currentMode()){if((m||k)&&"<br>"==b.substring(0,4))b=b.substr(4);if(m)b=b.replace(/<td([^>]*)>\s*<\/td/ig,"<td$1 ><br></td");var a="",c=l._getDoc(),d;a+="<html><head><style>\nbody{border:none;height:100%;margin:0;padding:2px;overflow:auto;";if(l.config.bgColor||l.config.textColor){if(l.config.bgColor)a+="background-color:"+l.config.bgColor+";";if(l.config.textColor)a+="color:"+l.config.textColor+";"}a+='}\nimg{cursor:default;}\n.selectedTD{background:#3399ff !important;}\n.splitPage{display:block;width:98%;!important;border-top:#999 1px solid;border-bottom:#999 1px solid;background:#FFFFFF; color:#000000;font-weight:bold;text-align:center;margin:30px auto 5;padding-top:30px;clear:both;}\n.splitPage:before{content:"\u5206\u9875\u6807\u9898:";}</style>\n';if(l.config.baseHref!="")a+='<base href="'+l.config.baseHref+'" />';if(l.config.css)a+='<link href="'+l.config.css+'" rel="stylesheet" type="text/css">\n';a+='</head><body contenteditable="true" >'+b+"</body></html>";c.open();c.write(a);c.close();d=Math.max(20,l._editorObj().offsetHeight-6);if(c.body){c.body.style.minHeight=d+"px";if(g)c.body.style.height=d+"px"}}l.setContent(b);l._changed()};l.setOpacity=function(b,a){if(f)b.style.filter=a==100?"":"gray() alpha(opacity="+a+")";else b.style.opacity=a==100?"":a/100};l.inArray=function(c,b){for(var a=b.length-1;a>=0;a--)if(c==b[a])return true;return false};l.content=function(){var d=l.currentMode(),c,b,a;if("visual"===d){c=l.selectedCells();for(b=c.length-1;b>=0;b--)c[b].className="";a=l._getDoc().body.innerHTML;for(b=c.length-1;b>=0;b--)c[b].className="selectedTD";if((m||k)&&"<br>"==a.substring(0,4))a=a.substr(4);if(""==a.replace(/<\/?(div|p|font|b|s|u|i|strong|em|strike)(?![a-z0-9])[^>]*>|&nbsp;|\s/ig,""))a="";if("function"===typeof l.config.ongetcontent)a=l.config.ongetcontent.call(l,a);else a=a.replace(/\s*<(p|table|tr|hr|div|object|ol|li|ul|h[1-6])(?![a-z])/ig,"\n<$1").replace(/<\/(p|table|div|object|ol|ul|h[1-6])>\s*/ig,"</$1>\n").replace(/(<(?:br|hr)(?![a-z0-9])[^>]*>)\s*/ig,"$1\n").replace(/^\s*/,"").replace(/\s*$/,"")}else a=l._editorObj().value;return a};l._autoSave=function(d){var c=l._editorObj(),b=d?a.addListener:a.delListener;if(f)b(c,"beforedeactivate",l.save);else if("code"==l.currentMode())b(c,"blur",l.save);else b(c.contentWindow,"blur",l.save)};l.save=function(){l.obj.value=l.content()};l._intEdit=function(a){if(a.isIniEdit)return;a.isIniEdit=true;a.style.imeMode="disabled";a.onkeypress=function(){if(45==event.keyCode){this.value="-"==this.value.charAt(0)?this.value.substr(1):"-"+this.value;return false}return event.keyCode>=48&&event.keyCode<=57};a.onpaste=function(){return!clipboardData.getData("text").match(/\D/)};a.ondragenter=function(){return!/\D/.test(event.dataTransfer.getData("text"))};a.oldBlur=a.onblur;a.onblur=function(){if(""==this.value)return;this.value=parseInt(this.value,10);var a=this.getAttribute("max"),b=this.getAttribute("min");if(a!==j&&parseInt(this.value,10)>parseInt(a,10))this.value=parseInt(a,10);if(b!=j&&parseInt(this.value,10)<parseInt(b,10))this.value=parseInt(b,10);this.oldBlur&&this.oldBlur()}};if(g||f&&(b.documentMode==7||b.compatMode!="CSS1Compat")){var s=function(a){var b=null;while(a){if(a.tagName=="TABLE")b=a;a=a.parentNode}return b},v=s(b.scripts(b.scripts.length-1));if(v&&s(a.find(t))===v)e.setTimeout(l.init,20);else l.init()}else l.init()};a.url="./";a.version=v;if(a.url==="./"){var t=b.scripts||b.getElementsByTagName("SCRIPT"),o=t[t.length-1].getAttribute("src"),s=/[\?&]skin=([a-z0-9_A-Z]+)/.exec(o),l=e.location,u=l.protocol+"//"+l.host+(l.port?":"+l.port:"")+"/",X="";a.url=o.substring(0,o.toLowerCase().indexOf("tqeditor."));if(a.url.indexOf(u)===0)a.url=a.url.substring(u.length-1,a.url.length);b.write('<link href="'+a.url+(s?"skin/"+s[1]+"/":"")+'TQEditor.css" id="TQEditorSkinCSS" rel="stylesheet" type="text/css" onload="TQE.checkSkin(this)" />')}a.config={paragraphs:[["\u6b63\u6587","p"],["\u6807\u98981","h1"],["\u6807\u98982","h2"],["\u6807\u98983","h3"],["\u6807\u98984","h4"],["\u6807\u98985","h5"],["\u6807\u98986","h6"],["\u9884\u5b9a\u4e49","pre"]],fontnames:[["\u5b8b\u4f53","\u5b8b\u4f53"],["\u65b0\u5b8b\u4f53","\u65b0\u5b8b\u4f53"],["\u4eff\u5b8b_GB2312","\u4eff\u5b8b_GB2312"],["\u9ed1\u4f53","\u9ed1\u4f53"],["\u5fae\u8f6f\u96c5\u9ed1","\u5fae\u8f6f\u96c5\u9ed1"],["\u6977\u4f53_GB2312","\u6977\u4f53_GB2312"],["Arial","arial, helvetica, sans-serif"],["Courier New","courier new, courier, mono"],["Georgia","Georgia, Times New Roman, Times, Serif"],["Tahoma","Tahoma, Arial, Helvetica, sans-serif"],["Times New Roman","times new roman, times, serif"]],fontsizes:[["\u7279\u5c0f","xx-small",1],["\u8f83\u5c0f","x-small",2],["\u5c0f","small",3],["\u4e2d","medium",4],["\u5927","large",5],["\u8f83\u5927","x-large",6],["\u7279\u5927","xx-large",7]],toolbar:"default",toolbarRight:[],showToolbarGroupHandle:true,tplFlash:'<embed  src="{$url}" width="{$width}" height="{$height}" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" wmode="transparent" allowscriptaccess="always"></embed>',tplFlv:'<embed src="'+a.url+'flvPlayer.swf" flashvars="vcastr_file={$url}&IsAutoPlay={$auto_start}" width="{$width}" height="{$height}" quality="high" bgcolor="#0E0E0E" name="play" align="middle" allowscriptaccess="sameDomain" allowfullscreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="opaque" />',tplRm:'<embed  src="{$url}" width={$width} height={$height} autostart="{$auto_start}"type="audio/x-pn-realaudio-plugin" console="Clip1" controls="ImageWindow" ></embed>',tplVideo:'<object classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"  type="application/x-ms-wmp" width="{$width}" height="{$height}"><PARAM NAME="URL" VALUE="{$url}" /><PARAM NAME="autoStart" VALUE="{$auto_start}" /><PARAM NAME="invokeURLs" VALUE="false"><PARAM NAME="playCount" VALUE="100"><PARAM NAME="Volume" VALUE="100"><PARAM NAME="defaultFrame" VALUE="datawindow"></object>',tplMusic:'<object id="tqeMP"  classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"  type="application/x-ms-wmp" width="230" height="64"><PARAM NAME="URL" VALUE="{$url}" /><PARAM NAME="autoStart" VALUE="{$auto_start}" /><PARAM NAME="invokeURLs" VALUE="false"><PARAM NAME="playCount" VALUE="100"><PARAM NAME="Volume" VALUE="100"><PARAM NAME="defaultFrame" VALUE="datawindow"></object>',tplSplitPage:'<h3 class="splitPage" name="split_page"></h3>',uploadFieldName:"file",imageUploadUrl:"",imageFileTypes:"*.jpg;*.gif;*.png;*.jpeg",imageFileSize:"2MB",directInsertUploadImage:false,linkUploadUrl:"",linkFileTypes:"*.*",linkFileSize:"2MB",flashUploadUrl:"",flashFileTypes:"*.swf",flashFileSize:"2MB",musicUploadUrl:"",musicFileTypes:"*.mp3;*.wma",musicFileSize:"2MB",videoUploadUrl:"",videoFileTypes:"*.flv;.mp4;*.mkv;*.wmv;*.asf;*.avi;*.rmvb;*.rm",videoFileSize:"2MB",enter2br:false,width:"auto",height:"auto",autoClean:true,faceCount:55,css:"",bgColor:"",textColor:"",typesetImageTextCenter:true,typesetIndentParagraph:false,typesetImageBorder:true,baseHref:"",resize:true,onfocus:null,onblur:null,onkeydown:null,onkeyup:null,oninit:null,ongetcontent:null,onsetcontent:null,debug:false};a.find=function(a){return b.getElementById(a)};a.CE=function(f,d,c,e){var a=b.createElement(f);if(d)a.id=d;if(c)a.innerHTML=c;e&&b.body.appendChild(a);return a};a.loadSkin=function(b){var c=a.find("TQEditorSkinCSS");c.href=a.url+(b&&"default"!=b?"skin/"+b+"/":"")+"TQEditor.css"};a.checkSkin=function(e){for(var d=b.styleSheets,c=d.length-1;c>=0;c--)if(d[c].href==e.href){if(k&&d[c].cssRules.length<1||!k&&d[c].rules.length<1)e.href=a.url+"TQEditor.css";break}};a._doc=function(){return b.compatMode!="CSS1Compat"?b.body:b.documentElement};a._docScrollTop=function(){return e.scrollY?e.scrollY:a._doc().scrollTop};a._docScrollLeft=function(){return e.scrollX?e.scrollX:a._doc().scrollLeft};a.pos=function(b){var c=0,d=0,e=b.getBoundingClientRect(),f=a._doc();c=e.left+a._docScrollLeft()-f.clientLeft;d=e.top+a._docScrollTop()-f.clientTop;return{x:c,y:d,left:c,top:d,width:b.offsetWidth,height:b.offsetHeight}};a._hideContext=function(){if(a.activeContext){a.activeContext.style.display="none";a.activeContext=null}};a.pop=function(b,c){if(a.activePop==b){a.hidePop();return false}a._hideContext();a.hidePop();a.activePop=b;b.relateObj=c;c.className="eButtonDropDown";b.style.display="block";var e=a.pos(c),d=e.x,g=1+c.clientHeight+e.y,f=a._docScrollLeft(),h=a._doc().clientWidth;if(d+b.offsetWidth>f+h)d-=b.offsetWidth-c.offsetWidth;b.style.left=d+"px";b.style.top=g+"px";return true};a.hidePop=function(){if(!a.activePop)return;var b=a.activePop;a.activePop=null;b.style.display="none";if(b.relateObj&&b.relateObj.className=="eButtonDropDown")b.relateObj.className="eButton";b=a.find("ColorPicker");if(b)b.style.display="none"};a.delListener=function(a,b,c){if(a.removeEventListener)a.removeEventListener(b,c,false);else a.detachEvent("on"+b,a["e"+b+c])};a.addListener=function(a,c,b){if(a.addEventListener)a.addEventListener(c,b,false);else{a["fn"+b]=b;a["e"+c+b]=function(c){a["fn"+b](c)};a.attachEvent("on"+c,a["e"+c+b])}};a._tags=function(a,b){return a.getElementsByTagName(b)};a.listenTags=function(f,g,d,e){for(var c=a._tags(f,g),b=c.length-1;b>=0;b--)a.addListener(c[b],d,e)};a._noSel=function(e,g){var h=function(){if(f){var a=event.srcElement.tagName;return"INPUT"==a||"TEXTAREA"==a}return false};if(g)for(var i=g.split(","),c,b,d=i.length-1;d>=0;d--){c=a._tags(e,i[d]);for(b=c.length-1;b>=0;b--){c[b].unselectable="on";c[b].onselectstart=h}}else{e.unselectable="on";e.onselectstart=h}};a._colorPickerUI=function(){var c=["00","33","66","99","CC","FF"],g=["FF0000","00FF00","0000FF","FFFF00","00FFFF","FF00FF"],h=191,a='<table width="'+h+'" cellpadding=0 ',d,b,e;a+=f?'cellspacing=1 border=0 bgcolor="#000000;">':'cellspacing=0 border=1 style="border-collapse:collapse;" >';for(d=0;d<2;d++)for(b=0;b<6;b++){a+="<tr height=10>";if(d>0)a+='<td bgcolor="#'+g[b]+'" name="'+name+'"></td>';else a+='<td bgcolor="#'+c[b]+c[b]+c[b]+'" ></td>';for(e=0;e<3;e++)for(l=0;l<6;l++)a+='<td bgcolor="#'+c[e+d*3]+c[l]+c[b]+'" ></td>';a+="</tr>"}a+='</table><div style="padding:2px 2px 1px 2px;line-height:25px;"><div style="height:25px;width:60px;display:block;float:left; margin-right:5px;" name=colorPreview></div><span name="colorValue" style="width:50px; display:inline-block;"></span><input type="button" value="'+O+'" /></div>';return a};a.pickColor=function(f,h,i){var c=a.find("ColorPicker");if(null==c){c=a.CE("DIV","ColorPicker",a._colorPickerUI(),true);c.className="ePopPanel";c.style.zIndex=99999999;c.onmouseover=function(){this.active=true};c.onmouseout=function(){this.active=false};a._noSel(c);a.listenTags(c,"TD","mouseover",function(){var a=this,b=this.parentNode.parentNode.parentNode.parentNode.lastChild,c=e.setInterval(function(){a.style.backgroundColor=a.style.backgroundColor!=""?"":"#FFFFFF"},500);b.firstChild.style.backgroundColor=this.bgColor;b.firstChild.nextSibling.innerHTML=this.bgColor;a.style.backgroundColor="#FFFFFF";a.onmouseout=function(){e.clearInterval(c);this.style.backgroundColor=""}});c.lastChild.lastChild.onclick=function(){this.parentNode.parentNode.style.display="none"};a.listenTags(c,"TD","mouseup",function(){this.parentNode.parentNode.parentNode.parentNode.style.display="none"});a.addListener(b,"mousedown",function(){var b=a.find("ColorPicker");if(!b.active)b.style.display="none"})}for(var g=a._tags(c,"TD"),d=g.length-1;d>=0;d--)g[d].onmousedown=function(a){f(this.bgColor);a=a||event;a.cancelBubble=true};c.lastChild.lastChild.onclick=function(a){f("");a=a||event;a.cancelBubble=true};c.style.left=h+"px";c.style.top=i+"px";c.style.display="block"};a.drag=function(c){c.style.position="absolute";c.onmousedown=function(d){var j,k,h,g,i=a.pos(this),l=a._docScrollLeft(),m=a._docScrollTop(),n=b.onmousemove,o=b.onmouseup;if(f){d=e.event;h=d.srcElement;j=l+d.clientX-i.x;k=m+d.clientY-i.y}else{h=d.target;j=d.pageX-i.x;k=d.pageY-i.y}g=h.tagName;if(h!=this&&(g=="INPUT"||g=="TEXTAREA"||g=="BUTTON"||g=="SELECT"))return;if(c.setCapture)c.setCapture();else e.captureEvents&&e.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);b.onmousemove=function(a){if(f){a=e.event;a.pageX=l+a.clientX;a.pageY=m+a.clientY}var b=a.pageX-j,d=a.pageY-k;c.style.left=b+"px";c.style.top=d+"px";c.style.cursor="move"};b.onmouseup=function(){if(c.releaseCapture)c.releaseCapture();else e.releaseEvents&&e.releaseEvents(Event.MOUSEMOVE|Event.MOUSEUP);b.onmousemove=n;b.onmouseup=o;c.style.cursor=""}}};a.clone=function(b){if(typeof b!="object")return b;if(b==null)return b;var c,d="[object Array]"==Object.prototype.toString.call(b)?[]:{};for(c in b)d[c]=a.clone(b[c]);return d};a.removeNode=function(a,b){if(a.removeNode)return a.removeNode(b);if(b)return a.parentNode.removeChild(a);while(a.firstChild)a.parentNode.insertBefore(a.firstChild,a);a.parentNode.removeChild(a)};a.updateCellsStatus=function(k){for(var e=k.rows,d,j,f,i,a,c,g,b=0;b<e.length;b++){c=0;for(a=0;a<e[b].cells.length;a++){f=e[b].cells[a];f.colStart=c;c+=f.colSpan;f.colEnd=c-1;f.rowStart=b;f.rowEnd=b+f.rowSpan-1}}for(b=0;b<e.length;b++){d=e[b].cells;for(a=0;a<d.length;a++){if(d[a].rowSpan<2)continue;for(c=1;c<d[a].rowSpan;c++){if(!e[b+c])break;j=e[b+c].cells;f=d[a];for(g=0;g<j.length;g++){i=j[g];if(i.colStart>=f.colStart){i.colStart+=f.colSpan;i.colEnd+=f.colSpan}}}}}for(b=e.length-1;b>=0;b--){d=e[b].cells;var h=d[0].rowSpan;for(a=d.length-1;a>0;a--){h=Math.min(h,d[a].rowSpan);if(h<2)break}if(--h>0){for(a=d.length-1;a>=0;a--){d[a].rowSpan-=h;d[a].rowEnd-=h}for(c=b-1;c>=0;c--)for(g=e[c].cells.length-1;g>=0;g--)if(e[c].cells[g].rowEnd>d[0].rowStart){e[c].cells[g].rowSpan-=h;e[c].cells[g].rowEnd-=h}}}};a.insertCol=function(i,j){var h=i.parentNode.parentNode.parentNode,c,f,d,g,b,e;a.updateCellsStatus(h);e=j?i.colStart:i.colEnd+1;for(g=h.rows.length-1;g>=0;g--){c=h.rows[g].cells;f=null;for(b=Math.min(e,c.length-1);b>=0;b--)if(c[b].colStart<=e){if(c[b].colStart==e)f=h.rows[g].insertCell(b);else if(c[b].colEnd==e-1)f=h.rows[g].insertCell(b+1);else if(c[b].colSpan>1&&c[b].colEnd>=e)c[b].colSpan++;else if(b==c.length-1&&c[b].colEnd<e)f=h.rows[g].insertCell(b+1);if(f)if(j){d=f.nextSibling;if(d&&d.rowSpan<2&&d.colStart==e)f.style.backgroundColor=d.style.backgroundColor}else{d=f.previousSibling;if(d&&d.rowSpan<2&&d.colEnd==e-1)f.style.backgroundColor=d.style.backgroundColor}break}}};a.insertRow=function(h,k){var e=h.parentNode.parentNode.parentNode,c,i,g,d,b,j=0,f;a.updateCellsStatus(e);f=k?h.rowStart:h.rowEnd+1;for(d=Math.min(e.rows.length-1,f-1);d>=0;d--){c=e.rows[d].cells;for(b=c.length-1;b>=0;b--)if(c[b].rowEnd>=f){c[b].rowSpan++;j+=c[b].colSpan}}c=e.rows[0].cells;for(b=c.length-1;b>=0;b--)j-=c[b].colSpan;i=e.insertRow(f);while(j++<0)i.insertCell(0).innerHTML="&nbsp;";a.updateCellsStatus(e);c=i.cells;g=e.rows[k?f+1:f-1].cells;b=g.length-1;for(d=c.length-1;d>=0;d--){while(b>=0&&g[b].colStart>c[d].colStart)b--;if(b>=0&&g[b].colStart==c[d].colStart&&g[b].colEnd==c[d].colEnd)c[d].style.backgroundColor=g[b].style.backgroundColor}};a.deleteCol=function(i){var g=i.parentNode.parentNode.parentNode,f=g.rows,b,d,h,e,c;a.updateCellsStatus(g);e=i.colStart;c=i.colEnd;for(d=f.length-1;d>=0;d--){for(h=Math.min(c,f[d].cells.length-1);h>=0;h--){b=f[d].cells[h];if(b.colEnd>=e&&b.colStart<=c)if(b.colStart>=e&&b.colEnd<=c)f[d].removeChild(b);else if(b.colStart<e&&b.colEnd>c)b.colSpan-=1+c-e;else if(b.colStart<e&&b.colEnd>=e)b.colSpan-=b.colEnd-e+1;else if(b.colStart<=c&&b.colEnd>c){b.colSpan-=1+c-b.colStart;b.innerHTML=""}}f[d].cells.length<1&&f[d].parentNode.removeChild(f[d])}f.length<1&&g.parentNode.removeChild(g)};a.deleteRow=function(l){var i=l.parentNode.parentNode.parentNode,c=i.rows,g,b,j,e,k,h,f,d;a.updateCellsStatus(i);f=l.rowStart;d=l.rowEnd;g=c[d+1];for(e=Math.min(d,c.length-1);e>=0;e--){for(k=c[e].cells.length-1;k>=0;k--){b=c[e].cells[k];if(b.rowEnd>=f&&b.rowStart<=d)if(b.rowStart>=f&&b.rowEnd<=d)c[e].removeChild(b);else if(b.rowStart<f&&b.rowEnd>d)b.rowSpan-=1+d-f;else if(b.rowStart<f&&b.rowEnd>=f)b.rowSpan-=b.rowEnd-f+1;else if(b.rowStart<=d&&b.rowEnd>d){if(g){for(h=0;h<g.cells.length;h++)if(g.cells[h].colStart>b.colEnd)break;j=g.insertCell(h);j.rowSpan=1+d-b.rowStart;j.colSpan=b.colSpan;j.style.backgroundColor=b.style.backgroundColor}c[e].removeChild(b)}}c[e].cells.length<1&&c[e].parentNode.removeChild(c[e])}c.length<1&&i.parentNode.removeChild(i)};a.toolbarMode={admin:{left:["paragraph","fontsize","|","bold","italic","underline","forecolor","backcolor","removeformat","|","justifyleft","justifycenter","orderedlist",["justifyright","unorderedlist","|","indent","outdent","|","superscript","subscript"],"||","createlink","insertimage","inserttable",["splitpage","inserthorizontalrule"],"|","insertmusic","insertflash","insertvideo","||","cleanword","typeset"],right:["fullscreen","mode","|","help"]},bbs:{left:["fontsize","|","bold","italic","underline","forecolor","backcolor","removeformat","|","justifyleft","justifycenter","orderedlist",["justifyright","unorderedlist","|","indent","outdent"],"||","createlink","insertimage","|","insertface","insertmusic","insertflash","insertvideo","|","typeset"],right:["fullscreen","mode","|","help"]},user:{left:["fontsize","|","bold","italic","underline","forecolor","backcolor","removeformat","|","justifyleft","justifycenter","orderedlist",["justifyright","unorderedlist","|","indent","outdent","|","inserthorizontalrule"],"||","createlink","insertimage","insertvideo","|","typeset"],right:["fullscreen","mode","|","help"]},mini:{left:["fontsize","|","bold","italic","underline","forecolor","backcolor","removeformat","|","align","|","createlink","insertimage"],right:["help"]},message:{left:["insertface","|","fontsize","|","bold","italic","underline","|","forecolor","backcolor","|","removeformat"],right:["help"]},full:{left:["paragraph","fontname","fontsize","|","bold","italic","underline","forecolor","backcolor","removeformat","||","align","list","iodent",["superscript","subscript"],"||","createlink","unlink","insertimage","inserttable","inserthorizontalrule","splitpage","insertface","|","insertmusic","insertflash","insertvideo","||","cleanword","typeset"],right:["fullscreen","mode","|","help"]},normal:{left:["paragraph","fontsize","|","bold","italic","underline","forecolor","backcolor","removeformat","||","justifyleft","justifycenter","orderedlist",["justifyright","unorderedlist","|","indent","outdent","|","superscript","subscript"],"||","createlink","insertimage","inserttable","|","insertvideo","|","typeset"],right:["fullscreen","mode","|","help"]}};a.toolbarBottons={paragraph:{text:"\u6bb5\u843d",click:function(d,j){var c=a.find(d.objId+"Paragraph"),b;if(null==c){var i="",e=d.config.paragraphs;for(b=0;b<e.length;b++)i+='<div name="FormatBlock" class="eMenuItem" unselectable=on onselectstart="return false" paraValue="'+e[b][1]+'">'+e[b][0]+"</div>";c=a.CE("DIV",d.objId+"Paragraph",i,true);c.className="ePopPanel";a._noSel(c);a.listenTags(c,"DIV","click",function(){a.hidePop();var b=this.getAttribute("paraValue");if(f)b="<"+b+">";d.exeCmd("FormatBlock",b)});if(g){var h=a._tags(c,"DIV");for(b=h.length-1;b>=0;b--)d._ieMouseStyle(h[b],"eMenuItem","eMenuItemUp","eMenuItem")}}a.pop(c,j)}},fontsize:{text:"\u6587\u5b57\u5927\u5c0f",click:function(d,i){var c=a.find(d.objId+"FontSize");if(null==c){for(var h="",f,e=d.config.fontsizes,b=0;b<e.length;b++)h+='<div name="FontSize" class="eMenuItem" unselectable=on onselectstart="return false" paraValue="'+e[b][2]+'" style="font-size:'+e[b][1]+';" >'+e[b][0]+"</div>";c=a.CE("DIV",d.objId+"FontSize",h,true);c.className="ePopPanel";a._noSel(c);a.listenTags(c,"DIV","click",function(){a.hidePop();d.exeCmd("FontSize",this.getAttribute("paraValue"))});if(g){f=a._tags(c,"DIV");for(b=f.length-1;b>=0;b--)d._ieMouseStyle(f[b],"eMenuItem","eMenuItemUp","eMenuItem")}}a.pop(c,i)}},fontname:{text:"\u5b57\u4f53",click:function(d,i){var c=a.find(d.objId+"FontName");if(null==c){for(var f,h="",e=d.config.fontnames,b=0;b<e.length;b++)h+='<div name="FontName" class="eMenuItem" unselectable=on onselectstart="return false"  paraValue="'+e[b][1]+'"  style="font-family:'+e[b][1]+';" >'+e[b][0]+"</div>";c=a.CE("DIV",d.objId+"FontName",h,true);c.className="ePopPanel";a._noSel(c);a.listenTags(c,"DIV","click",function(){a.hidePop();d.exeCmd("FontName",this.getAttribute("paraValue"))});if(g){f=a._tags(c,"DIV");for(b=f.length-1;b>=0;b--)d._ieMouseStyle(f[b],"eMenuItem","eMenuItemUp","eMenuItem")}}a.pop(c,i)}},forecolor:{text:"\u6587\u672c\u989c\u8272",click:function(b,a){b._showColorSelectUI(a,"forecolor")}},backcolor:{text:"\u80cc\u666f\u8272",click:function(b,a){b._showColorSelectUI(a,f?"backcolor":"hilitecolor")}},bold:{text:"\u7c97\u4f53",click:null},italic:{text:"\u659c\u4f53",click:null},underline:{text:"\u4e0b\u5212\u7ebf",click:null},strikethrough:{text:"\u5220\u9664\u7ebf",click:null},removeformat:{text:"\u6d88\u9664\u683c\u5f0f",click:function(e){a.hidePop();e.exeCmd("removeformat");if(m||k)return;var g=e._getRange(),f=function(a){return a.replace(/<\/?span[^>]*>/ig,"").replace(/<p [^>]*>/ig,"<p>").replace(/<div [^>]*>/ig,"<div>")},h="",d=g.htmlText,c,b;if(d)e.insertHtml(f(d));else{c=g.cloneContents().childNodes;for(b=0;b<c.length;b++)if("#comment"!=c[b].nodeName){d=c[b].outerHTML||c[b].nodeValue;if(d)h+=d}e.insertHtml(f(h))}}},submenu:{text:"",click:function(b,a){b._popAsMenu(a,a.getAttribute("submenu").split(","))}},subscript:{text:"\u4e0b\u6807",click:null},superscript:{text:"\u4e0a\u6807",click:null},align:{text:"\u5bf9\u9f50",click:function(b,a){b._popAsMenu(a,["justifyleft","justifycenter","justifyright"])}},justifyleft:{text:"\u5de6\u5bf9\u9f50",click:null},justifycenter:{text:"\u5c45\u4e2d\u5bf9\u9f50",click:null},justifyright:{text:"\u53f3\u5bf9\u9f50",click:null},list:{text:"\u5217\u8868",click:function(b,a){b._popAsMenu(a,["orderedlist","unorderedlist"])}},unorderedlist:{text:"\u9879\u76ee\u5217\u8868",click:function(b){a.hidePop();b.exeCmd("InsertUnorderedList")}},orderedlist:{text:"\u6570\u76ee\u5217\u8868",click:function(b){a.hidePop();b.exeCmd("InsertOrderedList")}},iodent:{text:"\u7f29\u8fdb\u65b9\u5411",click:function(b,a){b._popAsMenu(a,["indent","outdent"])}},outdent:{text:"\u51cf\u5c11\u7f29\u8fdb",click:null},indent:{text:"\u589e\u52a0\u7f29\u8fdb",click:null},inserthorizontalrule:{text:"\u63d2\u5165\u6c34\u5e73\u7ebf",click:null},createlink:{text:"\u6dfb\u52a0\u94fe\u63a5",click:function(b,h){var d=a.find(b.objId+"CreateLink");if(null==d){var g=function(){a.hidePop();var g=this.form.elements,f=g.url.value,d=g.target.value,e=g.title.value,h="";if("http://"==f||""==f){b.exeCmd("Unlink");return false}var i=b._getRange();if(n&&i.collapsed||!b.exeCmd("CreateLink",f)){if(d!=="")d=' target="'+d+'" ';if(e!=="")h=' title="'+e+'" ';b.insertHtml('<a href="'+f+'" '+h+d+">"+(e?e:f)+"</a>");return false}var c=b.focusNode();do if(c.tagName=="A"){if(""==d)c.removeAttribute("target");else c.setAttribute("target",d);if(""==e)c.removeAttribute("title");else c.setAttribute("title",e);break}while(c=c.parentNode);return false};d=b._popFormUI(b.objId+"CreateLink",J,D,g,null,b.config.linkUploadUrl,b.config.linkFileTypes,b.config.linkFileSize,"link");a.drag(d)}if(!a.pop(d,h))return;var f=a._tags(d,"FORM")[0],e=f.elements,c=b.focusNode();f.reset();do if(c.tagName=="A"){e.url.value=c.getAttribute("href");e.title.value=c.getAttribute("title");b.__selectOption(e.target,c.getAttribute("target"));break}while(c=c.parentNode);e.url.focus()}},unlink:{text:"\u5220\u9664\u94fe\u63a5",click:null},inserttable:{text:"\u63d2\u5165\u8868\u683c",click:function(g,t){var e=a.find(g.objId+"InsertTable");if(null==e){for(var o=y+'<div><table border=1 cellspacing=0 cellpadding=0 bgcolor="#FFFFFF"  bordercolor="#CCCCCC"  style="border:none;border-collapse:collapse;"><tbody>',b=0,s=0,b=0;b<5;b++){o+="<tr>";for(s=0;s<8;s++)o+='<td width="20" height="20"></td>';o+="</tr>"}o+='</tbody></table><div style="padding:2px 5px;">1 &times 1</div></div>';e=a.CE("DIV",g.objId+"InsertTable",o,true);e.className="ePopPanel";a._noSel(e);a.listenTags(e.lastChild,"TD","click",function(){a.hidePop();for(var c,b='<table style="border-collapse:collapse;" width=96% align=center border=1 cellspace=0 cellpadding=3 ><tbody>',d=this.parentNode.rowIndex;d>=0;d--){b+="<tr>";for(c=this.cellIndex;c>=0;c--)b+=f?'<td valign="top"></td>':'<td valign="top"><br></td>';b+="</tr>"}b+="</tbody></table>";g.insertHtml(b)});a.listenTags(e.lastChild,"TD","mouseover",function(){for(var b,e=this.cellIndex,a=this.parentNode,f=a.rowIndex,d=a.parentNode.parentNode,h=d.rows.length,g=a.cells.length,c=0;c<h;c++){a=d.rows[c];for(b=0;b<g;b++)a.cells[b].bgColor=c<=f&&b<=e?"#3399ff":""}d.parentNode.lastChild.innerHTML=f+1+" &times; "+(e+1)})}var d,c,l=g.selectedCells(),p=e.firstChild,q=p.firstChild,r=q.nextSibling,m=e.lastChild,n=e.lastChild.firstChild.firstChild.firstChild,u=n.cells.length,k=function(a,b){a.style.display=b?"":"none"};while(n){for(var b=0;b<u;b++)n.cells[b].bgColor="";n=n.nextSibling}m.lastChild.innerHTML="1 &times; 1";if(l.length){k(m,0);c=l[0]}else{k(m,1);c=g.focusNode();while(c&&c.nodeName!=="TD")c=c.parentNode}if(c){d=c.parentNode.parentNode.parentNode;k(p,1);k(q,g.canMergeSelectedCells());k(r,l.length<2&&(c.rowSpan>1||c.colSpan>1));k(r.nextSibling,q.style.display!="none"||r.style.display!="none")}else k(p,0);k(m.previousSibling,p.style.display!="none"&&m.style.display!="none");var i=e.firstChild.getElementsByTagName("A"),h=function(d,b){if(l.length>0)for(var a=l.length-1;a>=0;a--){l[a].align=d;l[a].vAlign=b}else if(c){c.align=d;c.vAlign=b}};for(b=i.length-1;b>=0;b--){i[b].href="#";i[b].onclick=function(){switch(this.id){case"eTableAlignDefault":d.align="";break;case"eTableAlignLeft":d.align="left";break;case"eTableAlignCenter":d.align="center";break;case"eTableAlignRight":d.align="right";break;case"eCellAlignLT":h("left","top");break;case"eCellAlignCT":h("center","top");break;case"eCellAlignRT":h("right","top");break;case"eCellAlignLC":h("left","middle");break;case"eCellAlignCC":h("center","middle");break;case"eCellAlignRC":h("right","middle");break;case"eCellAlignLB":h("left","bottom");break;case"eCellAlignCB":h("center","bottom");break;case"eCellAlignRB":h("right","bottom")}g.focus();return false}}i=e.firstChild.getElementsByTagName("INPUT");for(b=i.length-1;b>=0;b--){if(d)i[b].value=j==d[i[b].id]?"":d[i[b].id];i[b].onblur=function(){if(""==this.value)d.removeAttribute(this.id);else d[this.id]=this.value;d.style.borderCollapse=d.cellSpacing<1&&d.border==1?"collapse":""}}q.onclick=function(){a.hidePop();g.mergeSelectedCells();g.focus();return false};r.onclick=function(){a.hidePop();g.splitCell(c);g.focus();return false};if(!a.pop(e,t))return void 0}},insertimage:{text:"\u63d2\u5165\u56fe\u7247",click:function(d,i){var f=a.find(d.objId+"InsertImage");if(null==f){var h=function(){a.hidePop();var b=this.form.elements;d.insertImage(b.url.value,b.width.value,b.height.value,b.border.value,b.alt.value,b.align.value);return false};f=d._popFormUI(d.objId+"InsertImage",G,A,h,["width","height","border"],d.config.imageUploadUrl,d.config.imageFileTypes,d.config.imageFileSize,"image");a.drag(f)}if(!a.pop(f,i))return;var g=a._tags(f,"FORM")[0],e=g.elements,b=d._getRange(),c=b.commonAncestorContainer;g.reset();if(c){if(!b.collapsed&&b.startContainer==b.endContainer&&b.startOffset-b.endOffset<2&&b.startContainer.hasChildNodes())c=b.startContainer.childNodes[b.startOffset];if(c.tagName!="IMG"&&w&&""===b.toString())if(j===b.startContainer.length&&b.startContainer.firstChild===b.endContainer.previousSibling)c=b.startContainer.firstChild;else if(b.endContainer.lastChild===b.startContainer.nextSibling)c=b.endContainer.lastChild;else if(b.startContainer.length==b.startOffset&&b.endOffset==0&&b.startContainer.nextSibling==b.endContainer.previousSibling)c=b.startContainer.nextSibling;if(!c||c.tagName!="IMG")c=null}else if(b.length&&b.item(0).tagName=="IMG")c=b.item(0);if(c&&"IMG"==c.nodeName){e.url.value=c.getAttribute("src");e.width.value=c.width;e.height.value=c.height;e.border.value=c.border;e.alt.value=c.alt;d.__selectOption(e.align,c.align)}e.url.focus()}},insertface:{text:"\u8868\u60c5",click:function(d,h){var c=a.find(d.objId+"InsertFace");if(null==c){for(var e,f='<div class="eFace">',b=1;b<=d.config.faceCount;b++)f+='<img src="'+a.url+"face/"+b+'.gif" emot="'+b+'" />';f+="</div>";c=a.CE("DIV",d.objId+"InsertFace",f,true);c.className="ePopPanel";a._noSel(c);a.listenTags(c,"IMG","click",function(){a.hidePop();d.insertHtml('<img align=absMiddle src="'+this.getAttribute("src")+'" emot="'+this.getAttribute("emot")+'" />')});if(g){e=a._tags(c,"IMG");for(b=e.length-1;b>=0;b--)d._ieMouseStyle(e[b],"","imgHover","")}}a.pop(c,h)}},insertflash:{text:"\u63d2\u5165Flash",click:function(b,f){var c=a.find(b.objId+"InsertFlash"),d;if(null==c){var e=function(){a.hidePop();var c=this.form.elements;b.insertFlash(c.url.value,c.width.value,c.height.value);return false};c=b._popFormUI(b.objId+"InsertFlash",F,z,e,["width","height"],b.config.flashUploadUrl,b.config.flashFileTypes,b.config.flashFileSize,"flash");a.drag(c)}if(!a.pop(c,f))return;d=a._tags(c,"FORM")[0];d.reset();d.elements.url.focus()}},insertmusic:{text:"\u63d2\u5165\u97f3\u9891",click:function(b,f){var c=a.find(b.objId+"InsertMusic"),d;if(null==c){var e=function(){a.hidePop();var c=this.form.elements;b.insertMusic(c.url.value,c.auto_start.value);return false};c=b._popFormUI(b.objId+"InsertMusic",H,B,e,null,b.config.musicUploadUrl,b.config.musicFileTypes,b.config.musicFileSize,"music");a.drag(c)}if(!a.pop(c,f))return;d=a._tags(c,"FORM")[0];d.reset();d.elements.url.focus()}},insertvideo:{text:"\u63d2\u5165\u89c6\u9891",click:function(b,f){var c=a.find(b.objId+"InsertVideo"),d;if(null==c){var e=function(){a.hidePop();var c=this.form.elements;b.insertVideo(c.url.value,c.auto_start.value,c.width.value,c.height.value,c.video_type.value);return false};c=b._popFormUI(b.objId+"InsertVideo",I,C,e,["width","height"],b.config.videoUploadUrl,b.config.videoFileTypes,b.config.videoFileSize,"video");a.drag(c)}if(!a.pop(c,f))return;d=a._tags(c,"FORM")[0];d.reset();d.elements.url.focus()}},cleanword:{text:"\u6e05\u7406Word\u4ee3\u7801",click:function(b){a.hidePop();b.cleanWord(true)}},typeset:{text:"\u81ea\u52a8\u6392\u7248",click:function(b){a.hidePop();b.typeset()}},mode:{text:"\u67e5\u770b\u6e90\u7801",click:function(b){a.hidePop();b.changeMode()}},splitpage:{text:"\u63d2\u5165\u5206\u9875\u7b26",click:function(b){a.hidePop();b.insertHtml(b.config.tplSplitPage)}},group:{text:"",click:null},separator:{text:"",click:null},fullscreen:{text:"\u5168\u5c4f",click:function(b){a.hidePop();b.fullScreen()}},help:{text:"\u5e2e\u52a9",click:function(c,d){var b=a.find(c.objId+"TQHelpPanel");if(null==b){b=a.CE("DIV",c.objId+"TQHelpPanel",'<form class="ePopForm" style="line-height:20px;">TQEditor<br/>'+P+": "+v+"<br/>"+Q+": \u674e\u817e\u79cb(TengQiu Li)<br/>"+U+': <a href="http://www.e512.net" target="_blank">e512.net</a><br />'+T+': <a href="mailto:litqqs@163.com">litqqs@163.com</a><br /><a href="tencent://message/?uin=7775038&Site=e512.net&Menu=no" style="clear:both;"><span class="eButton" style="background-position: -1026px 0;width:20px;" ></span> 7775038</a></form>',true);b.className="ePopPanel"}a.pop(b,d)}}};e.tqEditor=e.tqeditor=e.TQEditor=e.TQE=a;e.isIE=f;e.isIE6=g;e.isIE9=w;e.isWebkit=n;e.isOpera=k;e.isGecko=m})(window); 
(function(a){if(!a){throw"\u5fc5\u987b\u5148\u52a0\u8f7d TQEditor.js ";return}var b=a.prototype;b.images=function(e){var d=this,c=[],g="",f=d._getDoc(),b,a;if("code"===d.currentMode())return c;b=f.getElementsByTagName("IMG");for(a=0;a<b.length;a++)c.push(e?b[a].src:b[a].getAttribute("src"));return c};b.flashs=function(){var d=this,c=[],f="",e=d._getDoc(),b,a;if("code"===d.currentMode())return c;b=e.getElementsByTagName("EMBED");for(a=0;a<b.length;a++){if(b[a].getAttribute("type").toLowerCase().indexOf("shockwave-flash")<0||b[a].getAttribute("flashvars").toLowerCase().indexOf(".flv"))continue;c.push(full_uri?b[a].src:b[a].getAttribute("src"))}return c};b.flvs=function(){var d=this,c=[],f="",e=d._getDoc(),b,a;if("code"===d.currentMode())return c;b=e.getElementsByTagName("EMBED");for(a=0;a<b.length;a++){if(b[a].getAttribute("flashvars").toLowerCase().indexOf("vcastr_file")<0)continue;/vcastr_file=([^\"& ]+)/i.exec(b[a].getAttribute("flashvars"));RegExp.$1&&c.push(RegExp.$1)}return c};b.removeLinks=function(d){var e=this,g=e._getDoc(),c,b,f;if("code"===e.currentMode())return;c=g.getElementsByTagName("A");if("function"===typeof d)for(b=c.length-1;b>=0;b--){f=d(c[b].getAttribute("href"));f&&a.removeNode(c[b],false)}else for(b=c.length-1;b>=0;b--)a.removeNode(c[b],false);return};b.removeImages=function(d){var e=this,g=e._getDoc(),c,b,f;if("code"===e.currentMode())return;c=g.getElementsByTagName("IMG");if("function"===typeof d)for(b=c.length-1;b>=0;b--){f=d(c[b].getAttribute("src"));f&&a.removeNode(c[b],false)}else for(b=c.length-1;b>=0;b--)a.removeNode(c[b],false);return};b.removeFlashs=function(d){var e=this,g=e._getDoc(),c,b,f;if("code"===e.currentMode())return;c=g.getElementsByTagName("EMBED");if("function"===typeof d)for(b=c.length-1;b>=0;b--){f=d(c[b].getAttribute("src"));f&&a.removeNode(c[b],false)}else for(b=c.length-1;b>=0;b--)a.removeNode(c[b],false);return};b.removeObjects=function(){var d=this,e=d._getDoc(),c,b,f;if("code"===d.currentMode())return;c=e.getElementsByTagName("OBJECT");for(b=c.length-1;b>=0;b--)a.removeNode(c[b],false)};b.getSelectText=function(b){var c=this,a=c.getSelectHtml();if(b)a=a.replace(/<(br|p|div|ul|ol|li|tr)[^>]*>\n?/g,"\n");return a.replace(/<(textarea|select|script|style)[^>]*>.*?<\/\1>/ig,"").replace(/<\/?[a-z][^>]*>/ig,"").replace(/\n+/g,"\n").replace(/&lt;/g,"<").replace(/&gt;/g,">").replace(/&nbsp;/g," ")};b.getSelectHtml=function(){var d=this;if("code"==d.currentMode()){var f=d._editorObj();if(document.selection){var k=document.selection.createRange();return k.text}return f.selectionStart!=f.selectionEnd?f.value.substring(f.selectionStart,f.selectionEnd):""}if(d.activeTable){var c,b,e,g=a.CE("DIV");g.innerHTML=d.activeTable.outerHTML;c=g.firstChild;for(b=c.rows.length-1;b>=0;b--){for(e=c.rows[b].cells.length-1;e>=0;e--)if(c.rows[b].cells[e].className=="selectedTD")c.rows[b].cells[e].className="";else c.rows[b].removeChild(c.rows[b].cells[e]);c.rows[b].cells.length<1&&c.rows[b].parentNode.removeChild(c.rows[b])}return g.innerHTML}d.focus();var i=d._getRange(),j=i.htmlText;if(j)return j;else{var g=a.CE("DIV"),h=i.cloneContents().childNodes;while(h.length)g.appendChild(h[0]);return g.innerHTML}}})(window.TQE); 
function ubb2html(g){var c=0,f=[],a=""+g,b="",e="http://www.qs.com/vt/inc/client/js/tqEditor/",d=function(a){return a.replace(/\[\]/g,function(a){return({"[":"%5b","]":"%5d"})[a]})};a=a.replace(/[<>\" ]/g,function(a){return({"<":"&lt;",">":"&gt;",'"':"&quot;"," ":"&nbsp;"})[a]}).replace(/\r?\n/g,"<br>");do b="__CODE__"+Math.random()+"_";while(a.indexOf(b)>=0);a=a.replace(/\[code[=\]].*?\[\/code\]/ig,function(a){f.push(a);return b+c+++"_"}).replace(/\[flv(?:\s*=\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+)\s*)?)?\](.*?)\[\/flv\]/ig,function(g,b,a,c,f){if(!b)b=320;if(!a)a=240;return'<embed id="flvPlayer" src="'+e+'flvPlayer.swf" flashvars="vcastr_file='+d(f)+"&IsAutoPlay="+c+'" width="'+b+'" height="'+a+'" quality="high" bgcolor="#0E0E0E" name="play" align="middle" allowscriptaccess="sameDomain" allowfullscreen="true" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" wmode="opaque" />'}).replace(/\[rm(?:\s*=\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d+)\s*)?)?\](.*?)\[\/rm\]/ig,function(f,b,a,c,e){if(!b)b=320;if(!a)a=240;return'<embed src="'+d(e)+'" width='+b+" height="+a+' autostart="'+c+'}" type="audio/x-pn-realaudio-plugin" console="Clip1" controls="ImageWindow" ></embed>'}).replace(/\[mp3\](.*?)\[\/mp3\]/ig,'<object id="mp3Player"  classid="clsid:6BF52A52-394A-11d3-B153-00C04F79FAA6"  type="application/x-ms-wmp" width="230" height="64"><PARAM NAME="URL" VALUE="$1" /><PARAM NAME="autoStart" VALUE="0" /><PARAM NAME="invokeURLs" VALUE="false"><PARAM NAME="playCount" VALUE="100"><PARAM NAME="Volume" VALUE="100"><PARAM NAME="defaultFrame" VALUE="datawindow"></object>').replace(/\[img\](.*?)\[\/img\]/ig,"<img src=$1 />").replace(/\[img(?:=\s*(\d+)\s*,\s*(\d+)\s*)\]\s*([\w_\-\.\/:]*)\s*\[\/img\]/ig,"<img src=$3 width=$1  height=$2 />").replace(/\[(color|size)\s*=\s*([^\]]+)\s*\]/ig,"<font $1=$2>").replace(/\[\/(color|size)\]/ig,"</font>").replace(/\[bg\s*=\s*([^\]]+)\s*\]/ig,'<span style="background:$1">').replace(/\[\/bg]/ig,"</span>").replace(/\[(left|center|right)]/ig,'<div style="text-align:$1">').replace(/\[\/(left|center|right)]/ig,"</div>").replace(/(?:<br>|\s)?\[list\](.*?)(<br>|\s)*\[\/list\]/ig,function(b,a){return"<ul>"+a.replace(/\<br\>(\s|&nbsp;)*\[\*\]/g,"<li>")+"</ul>"}).replace(/(?:<br>|\s)?\[numlist\](.*?)(<br>|\s)*\[\/numlist\]/ig,function(b,a){return"<ol>"+a.replace(/\<br\>(\s|&nbsp;)*\[\*\]/g,"<li>")+"</ol>"}).replace(/\[\:(\d+)]/g,'<img src="'+e+'face/$1.gif" emot="$1" align="absMiddle"  >').replace(/\[(\/?(?:b|u|i|s|sup|sub|h[1-6]))\]/ig,"<$1>").replace(/\[url\]\s*(((?!")[\s\S])*?)(?:"[\s\S]*?)?\s*\[\/url\]/ig,'<a href="$1">$1</a>').replace(/\[url\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]\s*([\s\S]*?)\s*\[\/url\]/ig,'<a href="$1">$2</a>').replace(/\[email\]\s*(((?!")[\s\S])+?)(?:"[\s\S]*?)?\s*\[\/email\]/ig,'<a href="mailto:$1">$1</a>').replace(/\[email\s*=\s*([^\]"]+?)(?:"[^\]]*?)?\s*\]\s*([\s\S]+?)\s*\[\/email\]/ig,'<a href="mailto:$1">$2</a>').replace(/\[qq\]\s*(\d+)\s*\[\/qq\]/ig,'<a href="tencent://message/?uin=$1">$1</a>').replace(/\[qq\s*=\s*(\d+)\s*\]\s*([\s\S]+?)\s*\[\/qq\]/ig,'<a href="tencent://message/?uin=$1">$2</a>').replace(/\[quote\]([\s\S]*?)\[\/quote\]/ig,"<blockquote>$1</blockquote>");while(/\[table\](((?!\[table)[\s\S])+?)\[\/table\]/i.test(a))a=a.replace(/\[table\](((?!\[table)[\s\S])+?)\[\/table\]/ig,function(b,a){return'<table style="border-collapse: collapse;" width=98% border="1" cellPadding="3">'+a.replace(/\[(\/?(?:tr|td|th))\]/ig,"<$1>")+"</table>"});c=-1;a=a.replace(new RegExp(b+"\\d+_","g"),function(){return f[++c]});return a}function html2ubb(h){var e=0,g=[],a=""+h,d="";do d="__CODE__"+Math.random()+"_";while(a.indexOf(d)>=0);a=a.replace(/[\r\n]/g,"").replace(/<br[^>]*>/ig,"\n");a=a.replace(/\[code[=\]].*?\[\/code\]/ig,function(a){g.push(a);return d+e+++"_"}).replace(/<embed ([^>]*)>/ig,function(h,f){var a,d,c="",e="",g="",b=f.toLowerCase();a=/width\s*=\s*\"?([^ \"]+)/i.exec(b);if(a)c="="+a[1];if(c!=""){a=/height\s*=\s*\"?([^ \"]+)/i.exec(b);if(a)e=","+a[1]}if(b.indexOf("vcastr_file")){a=/vcastr_file=([^\"&]+)/.exec(f);d=a[1];if(""!=c){a=/IsAutoPlay=(0|1)/.exec(f);if(a)g=","+a[1]}return"[flv"+c+e+g+"]"+d+"[/flv]"}if(b.indexOf("shockwave-flash")){a=/src\s*=\s*\"?([^ \"]+)/i.exec(b);d=a[1];return"[flash"+c+e+"]"+d+"[/flash]"}if(b.indexOf("realaudio-plugin")){a=/src\s*=\s*\"?([^ \"]+)/i.exec(b);d=a[1];if(""!=c){a=/autostart\s*=\s*\"?(0|1)/.exec(b);if(a)g=","+a[1]}return"[rm"+c+e+"]"+d+"[/rm]"}return""}).replace(/<object (.*?)<\/object>/ig,function(f,c){var a,d,e="",g="",h="",b=c.toLowerCase();a=/width\s*=\s*\"?([^ \"]+)/i.exec(b);if(a)e="="+a[1];if(e!=""){a=/height\s*=\s*\"?([^ \"]+)/i.exec(b);if(a)g=","+a[1]}a=/<PARAM\s+NAME\s*=\s*"?URL"?\s+VALUE\s*=\s*"?([^\"> ]+)"?/i.exec(c);d=a[1];return b.indexOf("mp3player")?"[mp3]"+d+"[/mp3]":f}).replace(/<img ([^>]+)>/ig,function(g,b){var a,e,c="",f="",h="",d=b.toLowerCase();a=/width\s*=\s*\"?([^ \"]+)/i.exec(d);if(a)c="="+a[1];if(c!=""){a=/height\s*=\s*\"?([^ \"]+)/i.exec(d);if(a)f=","+a[1]}a=/emot\s*=\s*"?(\d+)"?/i.exec(b);if(a)return"[:"+a[1]+"]";a=/src\s*=\s*"?([^\"> ]+)"?/i.exec(b);e=a[1];return"[img"+c+f+"]"+e+"[/img]"}).replace(/<ul[^>]*>/ig,"\n[list]").replace(/\s*<\/ul[^>]*>/ig,"\n[/list]").replace(/<ol[^>]*>/ig,"\n[numlist]").replace(/\s*<\/ol[^>]*>/ig,"\n[/numlist]").replace(/\s*<li[^>]*>/ig,"\n[*]").replace(/<\/li[^>]*>/ig,"").replace(/<(\/?(?:b|u|i|s|sup|sub|table|tr|td|th|h[1-6]))(?![a-z])[^>]*>/ig,"[$1]").replace(/<(\/)?(strong|em|strike|del)(?![a-z])[^>]*>/ig,function(d,a,b){var c=({strong:"b",em:"i",strike:"s",del:"s"})[b.toLowerCase()];if(a!=="/")a="";return"["+a+c+"]"}).replace(/<blockquote(?:\s+[^>]*?)?>([\s\S]+?)<\/blockquote>/ig,"[quote]$1[/quote]");var i,b,f=function(e,c,b){var a=(e*65536+c*256+b*1).toString(16),d=a.length;while(d++<6)a="0"+a;return"#"+a},c=function(b){var c="",a="";b=b.toLowerCase();if(/align\s*[=:]\s*\"?(left|center|right)/.exec(b)){c+="["+RegExp.$1+"]";a="[/"+RegExp.$1+"]"+a}if(/[^-]size\s*=\s*\"?(\d+\s*(?:px|pc|pt|em|ex|cm|mm)?)/.exec(b)){c+="[size="+RegExp.$1+"]";a="[/size]"+a}if(/[^-]color\s*[:=]\s*\"?rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(b)){c+="[color="+f(RegExp.$1,RegExp.$2,RegExp.$3)+"]";a="[/color]"+a}else if(/[^-]color\s*[:=]\s*\"?([a-z0-9#]+)/.exec(b)){c+="[color="+RegExp.$1+"]";a="[/color]"+a}if(/background(?:\-color)?\s*:\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)/.exec(b)){c+="[bg="+f(RegExp.$1,RegExp.$2,RegExp.$3)+"]";a="[/bg]"+a}else if(/background(?:\-color)?\s*:\s*([a-z0-9#]+)/.exec(b)){c+="[bg="+RegExp.$1+"]";a="[/bg]"+a}return{pre:c,end:a}};while(/<div([^>]*)>(((?!<div)[\s\S])*?)<\/div>/i.test(a))a=a.replace(/<div([^>]*)>(((?!<div)[\s\S])*?)<\/div>/ig,function(e,a,d){b=c(a);return"\n"+b.pre+d+b.end+"\n"});while(/<p([^>]*)>(((?!<p)[\s\S])*?)<\/p>/i.test(a))a=a.replace(/<p([^>]*)>(((?!<p)[\s\S])*?)<\/p>/ig,function(e,a,d){b=c(a);return"\n"+b.pre+d+b.end+"\n"});while(/<span([^>]*)>(((?!<span)[\s\S])*?)<\/span>/i.test(a))a=a.replace(/<span([^>]*)>(((?!<span)[\s\S])*?)<\/span>/ig,function(e,a,d){b=c(a);return b.pre+d+b.end});while(/<font([^>]*)>(((?!<font)[\s\S])*?)<\/font>/i.test(a))a=a.replace(/<font([^>]*)>(((?!<font)[\s\S])*?)<\/font>/ig,function(e,a,d){b=c(a);return b.pre+d+b.end});e=-1;a=a.replace(/<a .*?href\s*=\s*["']?([^'" ]+)[^>]*>([\s\S]*?)<\/a>/ig,function(e,a,c){var b="url";if("mailto:"==a.substr(0,7).toLowerCase()){b="email";a=a.substr(7,a.length)}else if("tencent:"==a.substr(0,8)){b="qq";var d=/uin=(\d+)/i.exec(a);a=d[1]}return c==a?"["+b+"]"+c+"[/"+b+"]":"["+b+"="+a+"]"+c+"[/"+b+"]"}).replace(/<\/?[a-z][^>]*>/ig,"").replace(new RegExp(d+"\\d+_","g"),function(){return g[++e]}).replace(/(&nbsp;|&gt;|&lt;|&quot;)/g,function(a){return({"&nbsp;":" ","&gt;":">","&lt;":"<","&quot;":'"'})[a]}).replace(/\n\s*\n/g,"\n\n");return a}function formatHTML(m){var d=m.replace(/<(strong|b|u|i|em|span|font)[^>]*><\/\1>/ig,""),a="",l=new RegExp("\\s*(<(\\/?)([a-z]\\w*)[^>]*>)[\\r\\n]*","im"),c=[],h={table:1,tbody:1,thead:1,tfoot:1,tr:1,td:1,p:1,caption:1,div:1,object:1,param:1,embed:1,dl:1,dd:1,dt:1,ul:1,ol:1,li:1,hr:1,script:1},f={table:1,tbody:1,thead:1,tfoot:1,tr:1,object:1,dl:1,ul:1,ol:1,div:1,script:1},i={a:1,u:1,i:1,b:1,strong:1,em:1,font:1,span:1,img:1,input:1,h1:1,h2:1,h3:1,h4:1,h5:1,h6:1},k,g,e,j,b;while(null!=(result=l.exec(d))){k=d.substr(0,result.index);g=result[0];e=result[1];j="/"===result[2];b=result[3].toLowerCase();d=d.substr(result.index+g.length);a+=k;if(j){f[b]&&c.pop();if(i[b])a+=g;else if(f[b])a+="\n"+c.join("")+e;else a+=e;if(h[b])a+="\n"}else{if(h[b])a+="\n";if(i[b])a+=g;else if(f[b])a+=c.join("")+e+"\n";else a+=c.join("")+e;if("hr"===b||"br"===b)a+="\n";f[b]&&c.push("  ")}}a+=d;a=a.replace(/\n+/g,"\n").replace(/^[ \n\r\t]+/g,"").replace(/[ \n\r\t]+$/g,"").replace(/<td([^>]*)>\s+<br/ig,"<td$1 ><br").replace(/<br>\s+<\/td>/ig,"<br></td>");if("<p>&nbsp;</p>"===a||"<br>"===a)a="";return a}