(function(e,ha){if(window.xheditor)return false;var xb=navigator.useragent.tolowercase().indexof("mobile")>-1,qa=e.browser,ca=parsefloat(qa.version),y=qa.msie,da=qa.mozilla,y=qa.safari,eb=qa.opera;e.fn.xheditor=function(b){if(xb)return false;var a=[];this.each(function(){if(e.nodename(this,"textarea"))if(b===false){if(this.xheditor){this.xheditor.remove();this.xheditor=null}}else if(this.xheditor)a.push(this.xheditor);else{var j=/({.*})/.exec(e(this).attr("class"));if(j){try{j=eval("("+j[1]+")")}catch(qa){}b= e.extend({},j,b)}j=new ea(this,b);if(j.init()){this.xheditor=j;a.push(j)}}});if(a.length===0)a=false;if(a.length===1)a=a[0];return a};var ia=0,z=false,fa=true,ga=false,fb=false,l,ra,sa,ja,s,ra,ka,sa,ta,ua,t;e("script[src*=xheditor]").each(function(){var b=this.src;if(b.match(/xheditor[^\/]*\.js/i)){t=b.replace(/[\?#].*$/,"").replace(/(^|[\/\\])[^\/]*$/,"$1");return false}});if(y)try{document.execcommand("backgroundimagecache",false,true)}catch(kb){}var yb={27:"esc",9:"tab",32:"space",13:"enter",8:"backspace", 145:"scroll",20:"capslock",144:"numlock",19:"pause",45:"insert",36:"home",46:"del",35:"end",33:"pageup",34:"pagedown",37:"left",38:"up",39:"right",40:"down",112:"f1",113:"f2",114:"f3",115:"f4",116:"f5",117:"f6",118:"f7",119:"f8",120:"f9",121:"f10",122:"f11",123:"f12"},gb=["#ffffff","#cccccc","#c0c0c0","#999999","#666666","#333333","#000000","#ffcccc","#ff6666","#ff0000","#cc0000","#990000","#660000","#330000","#ffcc99","#ff9966","#ff9900","#ff6600","#cc6600","#993300","#663300","#ffff99","#ffff66", "#ffcc66","#ffcc33","#cc9933","#996633","#663333","#ffffcc","#ffff33","#ffff00","#ffcc00","#999900","#666600","#333300","#99ff99","#66ff99","#33ff33","#33cc00","#009900","#006600","#003300","#99ffff","#33ffff","#66cccc","#00cccc","#339999","#336666","#003333","#ccffff","#66ffff","#33ccff","#3366ff","#3333ff","#000099","#000066","#ccccff","#9999ff","#6666cc","#6633ff","#6600cc","#333399","#330099","#ffccff","#ff99ff","#cc66cc","#cc33cc","#993399","#663366","#330033"],zb=[{n:"p",t:"\u666e\u901a\u6bb5\u843d"}, {n:"h1",t:"\u6807\u98981"},{n:"h2",t:"\u6807\u98982"},{n:"h3",t:"\u6807\u98983"},{n:"h4",t:"\u6807\u98984"},{n:"h5",t:"\u6807\u98985"},{n:"h6",t:"\u6807\u98986"},{n:"pre",t:"\u5df2\u7f16\u6392\u683c\u5f0f"},{n:"address",t:"\u5730\u5740"}],ab=[{n:"\u5b8b\u4f53",c:"simsun"},{n:"\u4eff\u5b8b\u4f53",c:"fangsong_gb2312"},{n:"\u9ed1\u4f53",c:"simhei"},{n:"\u6977\u4f53",c:"kaiti_gb2312"},{n:"\u5fae\u8f6f\u96c5\u9ed1",c:"microsoft yahei"},{n:"arial"},{n:"arial black"},{n:"comic sans ms"},{n:"courier new"}, {n:"system"},{n:"times new roman"},{n:"tahoma"},{n:"verdana"}],$=[{n:"x-small",s:"10px",t:"\u6781\u5c0f"},{n:"small",s:"13px",t:"\u7279\u5c0f"},{n:"medium",s:"16px",t:"\u5c0f"},{n:"large",s:"18px",t:"\u4e2d"},{n:"x-large",s:"24px",t:"\u5927"},{n:"xx-large",s:"32px",t:"\u7279\u5927"},{n:"-webkit-xxx-large",s:"48px",t:"\u6781\u5927"}],bb=[{s:"\u5de6\u5bf9\u9f50",v:"justifyleft"},{s:"\u5c45\u4e2d",v:"justifycenter"},{s:"\u53f3\u5bf9\u9f50",v:"justifyright"},{s:"\u4e24\u7aef\u5bf9\u9f50",v:"justifyfull"}], cb=[{s:"\u6570\u5b57\u5217\u8868",v:"insertorderedlist"},{s:"\u7b26\u53f7\u5217\u8868",v:"insertunorderedlist"}],db={"default":{name:"\u9ed8\u8ba4",width:24,height:24,line:7,list:{smile:"\u5fae\u7b11",tongue:"\u5410\u820c\u5934",titter:"\u5077\u7b11",laugh:"\u5927\u7b11",sad:"\u96be\u8fc7",wronged:"\u59d4\u5c48",fastcry:"\u5feb\u54ed\u4e86",cry:"\u54ed",wail:"\u5927\u54ed",mad:"\u751f\u6c14",knock:"\u6572\u6253",curse:"\u9a82\u4eba",crazy:"\u6293\u72c2",angry:"\u53d1\u706b",ohmy:"\u60ca\u8bb6",awkward:"\u5c34\u5c2c", panic:"\u60ca\u6050",shy:"\u5bb3\u7f9e",cute:"\u53ef\u601c",envy:"\u7fa1\u6155",proud:"\u5f97\u610f",struggle:"\u594b\u6597",quiet:"\u5b89\u9759",shutup:"\u95ed\u5634",doubt:"\u7591\u95ee",despise:"\u9119\u89c6",sleep:"\u7761\u89c9",bye:"\u518d\u89c1"}}},ta={cut:{t:"\u526a\u5207 (ctrl+x)"},copy:{t:"\u590d\u5236 (ctrl+c)"},paste:{t:"\u7c98\u8d34 (ctrl+v)"},pastetext:{t:"\u7c98\u8d34\u6587\u672c",h:y?0:1},blocktag:{t:"\u6bb5\u843d\u6807\u7b7e",h:1},fontface:{t:"\u5b57\u4f53",h:1},fontsize:{t:"\u5b57\u4f53\u5927\u5c0f", h:1},bold:{t:"\u52a0\u7c97 (ctrl+b)",s:"ctrl+b"},italic:{t:"\u659c\u4f53 (ctrl+i)",s:"ctrl+i"},underline:{t:"\u4e0b\u5212\u7ebf (ctrl+u)",s:"ctrl+u"},strikethrough:{t:"\u5220\u9664\u7ebf"},fontcolor:{t:"\u5b57\u4f53\u989c\u8272",h:1},backcolor:{t:"\u80cc\u666f\u989c\u8272",h:1},selectall:{t:"\u5168\u9009 (ctrl+a)"},removeformat:{t:"\u5220\u9664\u6587\u5b57\u683c\u5f0f"},align:{t:"\u5bf9\u9f50",h:1},list:{t:"\u5217\u8868",h:1},outdent:{t:"\u51cf\u5c11\u7f29\u8fdb"},indent:{t:"\u589e\u52a0\u7f29\u8fdb"}, link:{t:"\u8d85\u94fe\u63a5 (ctrl+l)",s:"ctrl+l",h:1},unlink:{t:"\u53d6\u6d88\u8d85\u94fe\u63a5"},anchor:{t:"\u951a\u70b9",h:1},img:{t:"\u56fe\u7247",h:1},flash:{t:"flash\u52a8\u753b",h:1},media:{t:"\u591a\u5a92\u4f53\u6587\u4ef6",h:1},hr:{t:"\u63d2\u5165\u6c34\u5e73\u7ebf"},emot:{t:"\u8868\u60c5",s:"ctrl+e",h:1},table:{t:"\u8868\u683c",h:1},source:{t:"\u6e90\u4ee3\u7801"},preview:{t:"\u9884\u89c8"},print:{t:"\u6253\u5370 (ctrl+p)",s:"ctrl+p"},fullscreen:{t:"\u5168\u5c4f\u7f16\u8f91 (esc)",s:"esc"} },va={mini:"bold,italic,underline,strikethrough,|,align,list,|,link,img",simple:"blocktag,fontface,fontsize,bold,italic,underline,strikethrough,fontcolor,backcolor,|,align,list,outdent,indent,|,link,img,emot",full:"cut,copy,paste,pastetext,|,blocktag,fontface,fontsize,bold,italic,underline,strikethrough,fontcolor,backcolor,selectall,removeformat,|,align,list,outdent,indent,|,link,unlink,anchor,img,flash,media,hr,emot,table,|,source,preview,print,fullscreen"};va.mfull= va.full.replace(/\|(,align)/i,"/$1");var eb={a:"link",img:"img",embed:"embed"},fb={"<":"<",">":">",'"':""","\u00ae":"®","\u00a9":"©"},gb=/[<>"\u00ae\u00a9]/g,ea=function(b,a){function j(a){a=a.target;var b=eb[a.tagname.tolowercase()];if(b){if(b==="embed")b={"application/x-shockwave-flash":"flash","application/x-mplayer2":"media"}[a.type.tolowercase()];d.exec(b)}}function qa(a){if(a.which===27){if(ga)d.removemodal();else z&&d.hidepanel();return false}}function hb(){settimeout(d.setsource, 10)}function aa(){d.getsource()}function ib(a){var b,c,g;if(a&&(b=a.originalevent.clipboarddata)&&(c=b.items)&&(g=c[0])&&g.kind=="file"&&g.type.match(/^image\//i)){a=g.getasfile();b=new filereader;b.onload=function(){var j='';j=jb(j);d.pastehtml(j)};b.readasdataurl(a);return false}var n=p.cleanpaste;if(n===0||f||wa)return true;wa=true;d.savebookmark();b=y?"pre":"div";var m=e("<"+b+' class="xhe-paste">\ufeff\ufeff",v).appendto(v.body);b=m[0];c=d.getsel(); g=d.getrng(true);m.css("top",ba.scrolltop());if(y){g.movetoelementtext(b);g.select();g.execcommand("paste");if(b.innerhtml=="\ufeff\ufeff"){m.remove();return}a.preventdefault()}else{g.selectnodecontents(b);c.removeallranges();c.addrange(g)}settimeout(function(){var j=n===3,i;if(j)i=m.text();else{var l=[];e(".xhe-paste",v.body).each(function(f,h){e(h).find(".xhe-paste").length==0&&l.push(h.innerhtml)});i=l.join("
")}m.remove();d.loadbookmark();if(j)d.pastetext(i);else{i=d.cleanhtml(i);i=d.cleanword(i); i=d.formatxhtml(i);if(!p.onpaste||p.onpaste&&(i=p.onpaste(i))!==false){i=jb(i);d.pastehtml(i)}}wa=false},0)}function jb(a){var b=p.localurltest,c=p.remoteimgsaveurl;if(b&&c){var g=[],n=0;a=a.replace(/(]*?)?(?:\s+src="\s*([^"]+)\s*")(?: [^>]*)?)(\/?>)/ig,function(m,j,i,l,f){if(/^(https?|data:image)/i.test(l)&&!b.test(l)){g[n]=l;i=i.replace(/\s+(width|height)="[^"]*"/ig,"").replace(/\s+src="[^"]*"/ig,' src="'+ha+'img/waiting.gif" remoteimg="'+n++ +'"')}return j+i+f});g.length>0&&e.post(c, {urls:g.join("|")},function(m){m=m.split("|");e("img[remoteimg]",d.doc).each(function(){var j=e(this);u(j,"src",m[j.attr("remoteimg")]);j.removeattr("remoteimg")})})}return a}function xa(a){try{d._exec("stylewithcss",a,true)}catch(b){try{d._exec("usecss",!a,true)}catch(c){}}}function ya(){if(za&&!f){xa(false);try{d._exec("enableobjectresizing",true,true)}catch(a){}if(y)try{d._exec("backgroundimagecache",true,true)}catch(b){}}}function hb(a){if(f||a.which!==13||a.shiftkey||a.ctrlkey||a.altkey)return true; a=d.getparent("p,h1,h2,h3,h4,h5,h6,pre,address,div,li");if(a.is("li"))return true;if(p.forceptag)a.length===0&&d._exec("formatblock","

");else{d.pastehtml("
");y&&a.length>0&&d.getrng().parentelement().childnodes.length===2&&d.pastehtml("
");return false}}function $a(){if(!da&&!y){ua&&o.height("100%").css("height",o.outerheight()-c.outerheight());y&&c.hide().show()}}function ib(a){a=a.target;if(a.tagname.match(/(img|embed)/i)){var b=d.getsel(),c=d.getrng(true);c.selectnode(a);b.removeallranges(); b.addrange(c)}}function u(a,b,c){if(!b)return false;var g="_xhe_"+b;if(c){if(ia)c=ca(c,ia,p);a.attr(b,p?ca(c,"abs",p):c).removeattr(g).attr(g,c)}return a.attr(g)||a.attr(b)}function ab(){fa&&d.hidepanel()}function jb(a){if(f)return true;var b=a.which,c=yb[b];b=c?c:string.fromcharcode(b).tolowercase();skey="";skey+=a.ctrlkey?"ctrl+":"";skey+=a.altkey?"alt+":"";skey+=a.shiftkey?"shift+":"";skey+=b;a=va[skey];for(var g in a){g=a[g];if(e.isfunction(g)){if(g.call(d)===false)return false}else{d.exec(g); return false}}}function v(a,b){var c=typeof a;if(!b)return c!="undefined";if(b==="array"&&a.hasownproperty&&a instanceof array)return true;return c===b}function ca(a,b,c){if(a.match(/^(\w+):\/\//i)&&!a.match(/^https?:/i)||a.match(/^#/i))return a;var g=c?e('')[0]:location;c=g.protocol;var n=g.host,m=g.hostname,j=g.port;g=g.pathname.replace(/\\/g,"/").replace(/[^\/]+$/i,"");if(j==="")j="80";if(g==="")g="/";else if(g.charat(0)!=="/")g="/"+g;a=e.trim(a);if(b!=="abs")a=a.replace(regexp(c+ "\\/\\/"+m.replace(/\./g,"\\.")+"(?::"+j+")"+(j==="80"?"?":"")+"(/|$)","i"),"/");if(b==="rel")a=a.replace(regexp("^"+g.replace(/([\/\.\+\[\]\(\)])/g,"\\$1"),"i"),"");if(b!=="rel"){a.match(/^(https?:\/\/|\/)/i)||(a=g+a);if(a.charat(0)==="/"){m=[];a=a.split("/");var i=a.length;for(g=0;g');var a= q.outerwidth(),b=q.outerheight();a=p.width||b.style.width||(a>10?a:0);x=p.height||b.style.height||(b>10?b:150);if(v(a,"number"))a+="px";if(v(x,"string"))x=x.replace(/[^\d]+/g,"");b=p.background||b.style.background;var c=[''],g,n,m=/\||\//i;e.each(p.tools,function(f,h){h.match(m)&&c.push('');if(h==="|")c.push('');else if(h==="/")c.push("
");else{g=ta[h];if(!g)return;n=g.c?g.c:"xheicon xhebtn"+h;c.push('
'+g.t+"");g.s&&d.addshortcuts(g.s,h)}h.match(m)&&c.push('')});c.push('
');q.after(e(''));c=e("#"+qb);o=e("#"+rb);za='';if(a=p.loadcss)if(v(a, "array"))for(var j in a)za+='';else za+=a.match(/\s*]*?)?>[\s\s]+?<\/style>\s*/i)?a:'';j=""+za+"\u53ef\u89c6\u5316\u7f16\u8f91\u5668,alt+1\u52309\u952e,\u5207\u6362\u5230\u5de5\u5177\u533a,tab\u952e,\u9009\u62e9\u6309\u94ae,esc\u952e,\u8fd4\u56de\u7f16\u8f91 "+(p.readtip?p.readtip:"")+"";if(b)j+="";j+='';d.win=la=e("#"+sb)[0].contentwindow;ba=e(la);try{this.doc=v=la.document;ma=e(v);v.open();v.write(j);v.close();if(y)v.body.contenteditable="true";else v.designmode="on"}catch(i){}settimeout(ya,300);d.setsource();la.setinterval=null;c.append(c.join("")).bind("mousedown contextmenu",w).click(function(f){var h=e(f.target).closest("a");if(h.is(".xheenabled")){cleartimeout(ja);c.find("a").attr("tabindex","-1");m=f;d.exec(h.attr("cmd"))}return false});c.find(".xhebutton").hover(function(f){var h= e(this),o=p.hoverexecdelay,k=da;da=null;if(o===-1||xa||!h.is(".xheenabled"))return false;if(k&&k>10){xa=true;settimeout(function(){xa=false},100);return false}var q=h.attr("cmd");if(ta[q].h!==1){d.hidepanel();return false}if(cb)o=0;if(o>=0)ja=settimeout(function(){m=f;oa={x:m.clientx,y:m.clienty};d.exec(q)},o)},function(){oa=null;ja&&cleartimeout(ja)}).mousemove(function(f){if(oa){var h={x:f.clientx-oa.x,y:f.clienty-oa.y};if(math.abs(h.x)>1||math.abs(h.y)>1){if(h.x>0&&h.y>0){h=math.round(math.atan(h.y/ h.x)/0.017453293);da=da?(da+h)/2:h}else da=null;oa={x:f.clientx,y:f.clienty}}}});l=e("#xhepanel");ra=e("#xheshadow");sa=e("#xhecntline");if(l.length===0){l=e('

').mousedown(function(f){f.stoppropagation()});ra=e('
');sa=e('
');settimeout(function(){e(document.body).append(l).append(ra).append(sa)},10)}e("#"+ya).show();q.hide();o.css("height",x-c.outerheight());y&ca<8&&settimeout(function(){o.css("height",x-c.outerheight())}, 1);q.focus(d.focus);mb.submit(aa).bind("reset",hb);p.submitid&&e("#"+p.submitid).click(aa);e(window).bind("unload beforeunload",aa).bind("resize",$a);e(document).mousedown(ab);if(!fb){e(document).keydown(qa);fb=true}ba.focus(function(){p.focus&&p.focus()}).blur(function(){p.blur&&p.blur()});y&&ba.click(ib);ma.mousedown(ab).keydown(jb).keypress(hb).dblclick(j).bind("mousedown click",function(f){q.trigger(f.type)});if(y){ma.keydown(function(f){var h=d.getrng();if(f.which===8&&h.item){e(h.item(0)).remove(); return false}});var l=function(f){f=e(f.target);var h;if(h=f.css("width"))f.css("width","").attr("width",h.replace(/[^0-9%]+/g,""));if(h=f.css("height"))f.css("height","").attr("height",h.replace(/[^0-9%]+/g,""))};ma.bind("controlselect",function(f){f=f.target;e.nodename(f,"img")&&e(f).unbind("resizeend",l).bind("resizeend",l)})}ma.keydown(function(f){var h=f.which;if(f.altkey&&h>=49&&h<=57){c.find("a").attr("tabindex","0");c.find(".xhegstart").eq(h-49).next().find("a").focus();v.title="\ufeff\ufeff"; return false}}).click(function(){c.find("a").attr("tabindex","-1")});c.keydown(function(f){var h=f.which;if(h==27){c.find("a").attr("tabindex","-1");d.focus()}else if(f.altkey&&h>=49&&h<=57){c.find(".xhegstart").eq(h-49).next().find("a").focus();return false}});j=e(v.documentelement);eb?j.bind("keydown",function(f){f.ctrlkey&&f.which===86&&ib()}):j.bind("paste",ib);p.disablecontextmenu&&j.bind("contextmenu",w);p.html5upload&&j.bind("dragenter dragover",function(f){var h;if((h=f.originalevent.datatransfer.types)&& e.inarray("files",h)!==-1)return false}).bind("drop",function(f){f=f.originalevent.datatransfer;var h;if(f&&(h=f.files)&&h.length>0){var o,k;f=["link","img","flash","media"];var q=[],r;for(o in f){k=f[o];p["up"+k+"url"]&&p["up"+k+"url"].match(/^[^!].*/i)&&q.push(k+":,"+p["up"+k+"ext"])}if(q.length===0)return false;else r=q.join(",");k=function(t){var s,w;for(o=0;o0?b.getrangeat(0):null}c||(c=v.body.createtextrange?v.body.createtextrange():v.createrange())}catch(g){}return c}; this.getparent=function(a){var b=d.getrng(),c;if(y)c=b.item?b.item(0):b.parentelement();else{c=b.commonancestorcontainer;if(!b.collapsed)if(b.startcontainer===b.endcontainer&&b.startoffset-b.endoffset<2&&b.startcontainer.haschildnodes())c=b.startcontainer.childnodes[b.startoffset]}a=a?a:"*";c=e(c);c.is(a)||(c=e(c).closest(a));return c};this.getselect=function(a){var b=d.getsel(),c=d.getrng(),g=true;g=!c||c.item?false:!b||c.boundingwidth===0||c.collapsed;if(a==="text")return g?"":c.text||(b.tostring? b.tostring():"");if(c.clonecontents){a=e("
");(c=c.clonecontents())&&a.append(c);c=a.html()}else c=v(c.item)?c.item(0).outerhtml:v(c.htmltext)?c.htmltext:c.tostring();if(g)c="";c=d.processhtml(c,"read");c=d.cleanhtml(c);return c=d.formatxhtml(c)};this.pastehtml=function(a,b){if(f)return false;d.focus();a=d.processhtml(a,"write");var c=d.getsel(),g=d.getrng();if(b!==ha){if(g.item){var n=g.item(0);g=d.getrng(true);g.movetoelementtext(n);g.select()}g.collapse(b)}a+="<"+(y?"img":"span")+' id="_xhe_temp" width="0" height="0" />'; if(g.insertnode){if(e(g.startcontainer).closest("style,script").length>0)return false;g.deletecontents();g.insertnode(g.createcontextualfragment(a))}else{if(c.type.tolowercase()==="control"){c.clear();g=d.getrng()}g.pastehtml(a)}n=e("#_xhe_temp",v);var m=n[0];if(y){g.movetoelementtext(m);g.select()}else{g.selectnode(m);c.removeallranges();c.addrange(g)}n.remove()};this.pastetext=function(a,b){a||(a="");a=d.domencode(a);a=a.replace(/\r?\n/g,"
");d.pastehtml(a,b)};this.appendhtml=function(a){if(f)return false; d.focus();a=d.processhtml(a,"write");e(v.body).append(a);d.settextcursor(true)};this.domencode=function(a){return a.replace(gb,function(b){return fb[b]})};this.setsource=function(a){na=null;if(typeof a!=="string"&&a!=="")a=b.value;if(f)e("#sourcecode",v).val(a);else{if(p.beforesetsource)a=p.beforesetsource(a);a=d.cleanhtml(a);a=d.formatxhtml(a);a=d.processhtml(a,"write");if(y){v.body.innerhtml=''+a+"\n";e("#_xhe_temp",v).remove()}else v.body.innerhtml=a}}; this.processhtml=function(a,b){if(b==="write"){a=a.replace(/(<(\/?)(\w+))((?:\s+[\w\-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*((\/?)>)/g,function(m,j,i,l,f,h,o){l=l.tolowercase();if(da)if(l==="strong")l="b";else{if(l==="em")l="i"}else if(y)if(l==="strong"){l="span";i||(f+=' class="apple-style-span" style="font-weight: bold;"')}else if(l==="em"){l="span";i||(f+=' class="apple-style-span" style="font-style: italic;"')}else if(l==="u"){l="span";i||(f+=' class="apple-style-span" style="text-decoration: underline;"')}else if(l=== "strike"){l="span";i||(f+=' class="apple-style-span" style="text-decoration: line-through;"')}var k,q="";if(l==="del")l="strike";else if(l==="img")f=f.replace(/\s+emot\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i,function(t,s){k=s.match(/^(["']?)(.*)\1/)[2];k=k.split(",");if(!k[1]){k[1]=k[0];k[0]=""}if(k[0]==="default")k[0]="";return p.emotmark?t:""});else if(l==="a"){if(!f.match(/ href=[^ ]/i)&&f.match(/ name=[^ ]/i))q+=" xhe-anchor";if(o)h=">"}else if(l==="table"&&!i){m=f.match(/\s+border\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i); if(!m||m[1].match(/^(["']?)\s*0\s*\1$/))q+=" xhe-border"}var r;f=f.replace(/\s+([\w\-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g,function(t,s,w){s=s.tolowercase();w=w.match(/^(["']?)(.*)\1/)[2];aft="";if(y&&s.match(/^(disabled|checked|readonly|selected)$/)&&w.match(/^(false|0)$/i))return"";if(l==="img"&&k&&s==="src")return"";if(s.match(/^(src|href)$/)){aft=" _xhe_"+s+'="'+w+'"';if(p)w=ca(w,"abs",p)}if(q&&s==="class"){w+=" "+q;q=""}if(y&&s==="style")if(l==="span"&&w.match(/(^|;)\s*(font-family|font-size|color|background-color)\s*:\s*[^;]+\s*(;|$)/i))r= true;return" "+s+'="'+w+'"'+aft});if(k){m=ea+(k[0]?k[0]:"default")+"/"+k[1]+".gif";f+=' src="'+m+'" _xhe_src="'+m+'"'}if(r)f+=' class="apple-style-span"';if(q)f+=' class="'+q+'"';return"<"+i+l+f+h});if(y)a=a.replace(/'/ig,"'");if(!y){var c=function(m,j,i,l){j="";var f,h;if(f=i.match(/font-family\s*:\s*([^;"]+)/i))j+=' face="'+f[1]+'"';if(f=i.match(/font-size\s*:\s*([^;"]+)/i)){f=f[1].tolowercase();for(var o=0;o<$.length;o++)if(f===$[o].n||f===$[o].s){h=o+1;break}if(h){j+=' size="'+h+'"'; i=i.replace(/(^|;)(\s*font-size\s*:\s*[^;"]+;?)+/ig,"$1")}}if(h=i.match(/(?:^|[\s;])color\s*:\s*([^;"]+)/i)){if(f=h[1].match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){h[1]="#";for(o=1;o<=3;o++)h[1]+=(f[o]-0).tostring(16)}h[1]=h[1].replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,"#$1$1$2$2$3$3");j+=' color="'+h[1]+'"'}i=i.replace(/(^|;)(\s*(font-family|color)\s*:\s*[^;"]+;?)+/ig,"$1");if(j!==""){if(i)j+=' style="'+i+'"';return""+l+""}else return m};a=a.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"(?: [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\s]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\s]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\s])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig, c);a=a.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"(?: [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\s]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\s])*?<\/\1>)*?)<\/\1>/ig,c);a=a.replace(/<(span)(?:\s+[^>]*?)?\s+style\s*=\s*"((?:[^"]*?;)?\s*(?:font-family|font-size|color)\s*:[^"]*)"(?: [^>]*)?>(((?!<\1(\s+[^>]*?)?>)[\s\s])*?)<\/\1>/ig,c)}a=a.replace(/<(td|th)(\s+[^>]*?)?>(\s| )*<\/\1>/ig,"<$1$2>"+(y?"":"
")+"")}else{if(y){var g=[{r:/font-weight:\sbold/ig, t:"strong"},{r:/font-style:\sitalic/ig,t:"em"},{r:/text-decoration:\sunderline/ig,t:"u"},{r:/text-decoration:\sline-through/ig,t:"strike"}];c=function(m,j,i,l,f){j=i+l;i="";if(!j)return f;for(l=0;l"+f+"":m};for(var n=0;n<2;n++){a=a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\s]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\s]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\s])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig, c);a=a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\s]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\s])*?<\/\1>)*?)<\/\1>/ig,c);a=a.replace(/<(span)(\s+[^>]*?)?\s+class\s*=\s*"apple-style-span"(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\s])*?)<\/\1>/ig,c)}}a=a.replace(/(<(\w+))((?:\s+[\w\-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*(\/?>)/g,function(m,j,i,l,f){i=i.tolowercase();var h;l=l.replace(/\s+_xhe_(?:src|href)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i,function(o, k){h=k.match(/^(["']?)(.*)\1/)[2];return""});if(h&&ia)h=ca(h,ia,p);l=l.replace(/\s+([\w\-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g,function(o,k,q){k=k.tolowercase();q=q.match(/^(["']?)(.*)\1/)[2];if(k==="class"){if(q.match(/^["']?(apple|webkit)/i))return"";q=q.replace(/\s?xhe-[a-z]+/ig,"");if(q==="")return""}else if(k.match(/^((_xhe_|_moz_|_webkit_)|jquery\d+)/i))return"";else if(h&&k.match(/^(src|href)$/i))return" "+k+'="'+h+'"';else if(k==="style")q=q.replace(/(^|;)\s*(font-size)\s*:\s*([a-z-]+)\s*(;|$)/i, function(r,t,s,w,i){for(var n,d=0;d<$.length;d++){r=$[d];if(w===r.n){n=r.s;break}}return t+s+":"+n+i});return" "+k+'="'+q+'"'});if(i==="img"&&!l.match(/\s+alt\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i))l+=' alt=""';return j+l+f});a=a.replace(/(<(td|th)(?:\s+[^>]*?)?>)\s*([\s\s]*?)()?\s*<\/\2>/ig,function(m,j,i,l){return j+(l?l:" ")+""});a=a.replace(/^\s*(?:<(p|div)(?:\s+[^>]*?)?>)?\s*(]*?)?>\s*<\/span>|]*?)?>| )*\s*(?:<\/\1>)?\s*$/i,"")}return a=a.replace(/(]*?)?>)([\s\s]+?)(<\/pre>)/gi, function(m,j,i,l){return j+i.replace(//ig,"\r\n")+l})};this.getsource=function(a){var b,c=p.beforegetsource;if(f){b=e("#sourcecode",v).val();c||(b=d.formatxhtml(b,false))}else{b=d.processhtml(v.body.innerhtml,"read");b=d.cleanhtml(b);b=d.formatxhtml(b,a);if(c)b=c(b)}return b.value=b};this.cleanword=function(a){var b=p.cleanpaste;if(b>0&&b<3&&a.match(/mso(-|normal)|worddocument|]*?x:str/i)){a=a.replace(/