(function(e,ha){if(e.xheditor)return false;e.fn.xheditor=function(B){var E=[];this.each(function(){if(e.nodeName(this,"TEXTAREA"))if(B===false){if(this.xheditor){this.xheditor.remove();this.xheditor=null}}else if(this.xheditor)E.push(this.xheditor);else{var I=/({.*})/.exec(e(this).attr("class"));if(I){try{I=eval("("+I[1]+")")}catch(Ma){}B=e.extend({},I,B)}I=new e.xheditor(this,B);if(I.init()){this.xheditor=I;E.push(I)}}});if(E.length===0)E=false;if(E.length===1)E=E[0];return E};var ia=0,Ba=e.browser.version,
y=e.browser.msie,Ca=e.browser.mozilla,V=e.browser.safari,cb=e.browser.opera,S=false,Da=true,Ea=false,db=false,N,oa,pa,ja,Y,Na,ka,Oa,Pa,Qa,W;e("script[src*=xheditor]").each(function(){var B=this.src;if(B.match(/xheditor[^\/]*\.js/i)){W=B.replace(/[\?#].*$/,"").replace(/(^|[\/\\])[^\/]*$/,"$1");return false}});var tb={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"},ub=["#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"],vb=[{n:"p",t:"Paragraph"},{n:"h1",t:"Heading 1"},{n:"h2",t:"Heading 2"},{n:"h3",t:"Heading 3"},{n:"h4",t:"Heading 4"},{n:"h5",t:"Heading 5"},{n:"h6",t:"Heading 6"},{n:"pre",
t:"Preformatted"},{n:"address",t:"Address"}],wb=[{n:"Arial"},{n:"Arial Narrow"},{n:"Arial Black"},{n:"Comic Sans MS"},{n:"Courier New"},{n:"System"},{n:"Times New Roman"},{n:"Tahoma"},{n:"Verdana"}],T=[{n:"xx-small",wkn:"x-small",s:"8pt",t:"xx-small"},{n:"x-small",wkn:"small",s:"10pt",t:"x-small"},{n:"small",wkn:"medium",s:"12pt",t:"small"},{n:"medium",wkn:"large",s:"14pt",t:"medium"},{n:"large",wkn:"x-large",s:"18pt",t:"large"},{n:"x-large",wkn:"xx-large",s:"24pt",t:"x-large"},{n:"xx-large",wkn:"-webkit-xxx-large",
s:"36pt",t:"xx-large"}],xb=[{s:"Align left",v:"justifyleft",t:"Align left"},{s:"Align center",v:"justifycenter",t:"Align center"},{s:"Align right",v:"justifyright",t:"Align right"},{s:"Align full",v:"justifyfull",t:"Align full"}],yb=[{s:"Ordered list",v:"insertOrderedList",t:"Ordered list"},{s:"Unordered list",v:"insertUnorderedList",t:"Unordered list"}],zb={"default":{name:"Default",width:24,height:24,line:7,list:{smile:"Smile",tongue:"Tongue",titter:"Titter",laugh:"Laugh",sad:"Sad",wronged:"Wronged",
fastcry:"Fast cry",cry:"Cry",wail:"Wail",mad:"Mad",knock:"Knock",curse:"Curse",crazy:"Crazy",angry:"Angry",ohmy:"Oh my",awkward:"Awkward",panic:"Panic",shy:"Shy",cute:"Cute",envy:"Envy",proud:"Proud",struggle:"Struggle",quiet:"Quiet",shutup:"Shut up",doubt:"Doubt",despise:"Despise",sleep:"Sleep",bye:"Bye"}}},qa={Cut:{t:"Cut (Ctrl+X)"},Copy:{t:"Copy (Ctrl+C)"},Paste:{t:"Paste (Ctrl+V)"},Pastetext:{t:"Paste as plain text",h:y?0:1},Blocktag:{t:"Block tag",h:1},Fontface:{t:"Font family",h:1},FontSize:{t:"Font size",
h:1},Bold:{t:"Bold (Ctrl+B)",s:"Ctrl+B"},Italic:{t:"Italic (Ctrl+I)",s:"Ctrl+I"},Underline:{t:"Underline (Ctrl+U)",s:"Ctrl+U"},Strikethrough:{t:"Strikethrough"},FontColor:{t:"Select text color",h:1},BackColor:{t:"Select background color",h:1},SelectAll:{t:"SelectAll (Ctrl+A)"},Removeformat:{t:"Remove formatting"},Align:{t:"Align",h:1},List:{t:"List",h:1},Outdent:{t:"Outdent (Shift+Tab)",s:"Shift+Tab"},Indent:{t:"Indent (Tab)",s:"Tab"},Link:{t:"Insert/edit link (Ctrl+K)",s:"Ctrl+K",h:1},Unlink:{t:"Unlink"},
Img:{t:"Insert/edit image",h:1},Flash:{t:"Insert/edit flash",h:1},Media:{t:"Insert/edit media",h:1},Emot:{t:"Emotions",s:"ctrl+e",h:1},Table:{t:"Insert a new table",h:1},Source:{t:"Edit source code"},Preview:{t:"Preview"},Print:{t:"Print (Ctrl+P)",s:"Ctrl+P"},Fullscreen:{t:"Toggle fullscreen (Esc)",s:"Esc"},About:{t:"About xhEditor"}},Ra={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,Img,Flash,Media,Emot,Table,|,Source,Preview,Print,Fullscreen"};Ra.mfull=Ra.full.replace(/\|(,Align)/i,"/$1");var Ab={a:"Link",img:"Img",embed:"Embed"},Bb={"<":"&lt;",">":"&gt;",'"':"&quot;","\u00ae":"&reg;","\u00a9":"&copy;"},Cb=/[<>"\u00ae\u00a9]/g;e.xheditor=function(B,E){function I(a){a=a.target;var b=Ab[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 Ma(a){if(a.which===27){if(Ea)d.removeModal();else S&&d.hidePanel();return false}}function eb(){setTimeout(d.setSource,10)}function ra(){d.getSource()}function fb(a){var b=o.cleanPaste;if(b===0||H||Sa)return true;Sa=true;d.saveBookmark();var c=y?"pre":"div",h=e("<"+c+' class="xhe-paste" style="top:'+Z.scrollTop()+'px;">&nbsp;</'+c+">",w);c=h[0];var p=d.getSel(),
m=d.getRng(true);e(w.body).append(h);if(y){m.moveToElementText(c);m.select();m.execCommand("Paste");a.preventDefault()}else{m.selectNodeContents(c);p.removeAllRanges();p.addRange(m)}setTimeout(function(){var n=b===3,i;if(n)i=h.text();else{i=e(".xhe-paste",h);var j=[];if(i.length===0)i=h;i.each(function(f,g){j.push(g.innerHTML)});i=j.join("<br />")}h.remove();d.loadBookmark();if(n)d.pasteText(i);else{i=d.cleanHTML(i);i=d.cleanWord(i);i=d.formatXHTML(i);d.pasteHTML(i)}Sa=false},0)}function Ta(a){try{d._exec("styleWithCSS",
a,true)}catch(b){try{d._exec("useCSS",!a,true)}catch(c){}}}function Ua(){if(Va&&!H){Ta(false);try{d._exec("enableObjectResizing",true,true)}catch(a){}if(y)try{d._exec("BackgroundImageCache",true,true)}catch(b){}}}function Db(a){if(H||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(o.forcePtag)a.length===0&&d._exec("formatblock","<p>");else{d.pasteHTML("<br />");y&&a.length>0&&d.getRng().parentElement().childNodes.length===
2&&d.pasteHTML("<br />");return false}}function Wa(){if(!Ca&&!V){sa&&O.height("100%").css("height",O.outerHeight()-M.outerHeight());y&&M.hide().show()}}function Eb(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 $(a,b,c){if(!b)return false;var h="_xhe_"+b;if(c){if(Fa)c=aa(c,Fa,P);a.attr(b,P?aa(c,"abs",P):c).removeAttr(h).attr(h,c)}return a.attr(h)||a.attr(b)}function Xa(){Da&&d.hidePanel()}function Fb(a){if(H)return true;
var b=a.which,c=tb[b];b=c?c:String.fromCharCode(b).toLowerCase();sKey="";sKey+=a.ctrlKey?"ctrl+":"";sKey+=a.altKey?"alt+":"";sKey+=a.shiftKey?"shift+":"";sKey+=b;a=ta[sKey];for(var h in a){h=a[h];if(e.isFunction(h)){if(h.call(d)===false)return false}else{d.exec(h);return false}}}function ba(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 aa(a,b,c){if(a.match(/^(\w+):\/\//i)&&!a.match(/^https?:/i))return a;var h=
c?e('<a href="'+c+'" />')[0]:location;c=h.protocol;var p=h.host,m=h.hostname,n=h.port;h=h.pathname.replace(/\\/g,"/").replace(/[^\/]+$/i,"");if(n==="")n="80";if(h==="")h="/";else if(h.charAt(0)!=="/")h="/"+h;a=e.trim(a);if(b!=="abs")a=a.replace(RegExp(c+"\\/\\/"+m.replace(/\./g,"\\.")+"(?::"+n+")"+(n==="80"?"?":"")+"(/|$)","i"),"/");if(b==="rel")a=a.replace(RegExp("^"+h.replace(/([\/\.\+\[\]\(\)])/g,"\\$1"),"i"),"");if(b!=="rel"){a.match(/^(https?:\/\/|\/)/i)||(a=h+a);if(a.charAt(0)==="/"){m=[];a=
a.split("/");var i=a.length;for(h=0;h<i;h++){n=a[h];if(n==="..")m.pop();else n!==""&&n!=="."&&m.push(n)}a[i-1]===""&&m.push("");a="/"+m.join("/")}}if(b==="abs"&&!a.match(/^https?:\/\//i))a=c+"//"+p+a;return a=a.replace(/(https?:\/\/[^:\/?#]+):80(\/|$)/i,"$1$2")}function gb(a,b){if(b==="*"||a.match(RegExp(".("+b.replace(/,/g,"|")+")$","i")))return true;else{alert("Upload file extension required for this: "+b);return false}}function hb(a){var b=Math.floor(Math.log(a)/Math.log(1024));return(a/Math.pow(1024,
Math.floor(b))).toFixed(2)+["Byte","KB","MB","GB","TB","PB"][b]}function X(){return false}var d=this,Q=e(B),ib=Q.closest("form"),M,O,ca,Z,w,ua,la,Va=false,H=false,sa=false,Sa=false,Ya,va=false,jb="",R=null,Za,wa=false,$a=false,ma=null,da=null,U=0,o=d.settings=e.extend({},{skin:"default",tools:"full",clickCancelDialog:true,linkTag:false,internalScript:false,inlineScript:false,internalStyle:true,inlineStyle:true,showBlocktag:false,forcePtag:true,upLinkExt:"zip,rar,txt",upImgExt:"jpg,jpeg,gif,png",upFlashExt:"swf",
upMediaExt:"wmv,avi,wma,mp3,mid",modalWidth:350,modalHeight:220,modalTitle:true,defLinkText:"Click here",layerShadow:3,emotMark:false,upBtnText:"Upload",cleanPaste:2,hoverExecDelay:100,html5Upload:true,upMultiple:99},E),Ga=o.plugins,Ha=[];if(Ga){qa=e.extend({},qa,Ga);e.each(Ga,function(a){Ha.push(a)});Ha=Ha.join(",")}if(o.tools.match(/^\s*(m?full|simple|mini)\s*$/i)){var kb=Ra[e.trim(o.tools)];o.tools=o.tools.match(/m?full/i)&&Ga?kb.replace("Table","Table,"+Ha):kb}o.tools.match(/(^|,)\s*About\s*(,|$)/i)||
(o.tools+=",About");o.tools=o.tools.split(",");if(o.editorRoot)W=o.editorRoot;W=aa(W,"abs");if(o.urlBase)o.urlBase=aa(o.urlBase,"abs");var lb="xheCSS_"+o.skin,xa="xhe"+ia+"_container",mb="xhe"+ia+"_Tool",nb="xhe"+ia+"_iframearea",ob="xhe"+ia+"_iframe",Ia="xhe"+ia+"_fixffcursor",ya="",na="",ab=W+"xheditor_skin/"+o.skin+"/",Ja=zb,Fa=o.urlType,P=o.urlBase,ea=o.emotPath;ea=ea?ea:W+"xheditor_emot/";var bb="";Ja=e.extend({},Ja,o.emots);ea=aa(ea,"rel",P?P:null);if(va=o.showBlocktag)na+=" showBlocktag";var ta=
[];this.init=function(){e("#"+lb).length===0&&e("head").append('<link id="'+lb+'" rel="stylesheet" type="text/css" href="'+ab+'ui.css" />');var a=o.width||B.style.width||Q.outerWidth();U=o.height||B.style.height||Q.outerHeight();if(ba(U,"string"))U=U.replace(/[^\d]+/g,"");if(a<=0||U<=0){alert("Current textarea is hidden, please make it show before initialization xhEditor, or directly initialize the height.");return false}if(/^[0-9\.]+$/i.test(""+a))a+="px";var b=o.background||B.style.background,c=
['<span class="xheGStart"/>'],h,p,m=/\||\//i;e.each(o.tools,function(f,g){g.match(m)&&c.push('<span class="xheGEnd"/>');if(g==="|")c.push('<span class="xheSeparator"/>');else if(g==="/")c.push("<br />");else{h=qa[g];if(!h)return;p=h.c?h.c:"xheIcon xheBtn"+g;c.push('<span><a href="javascript:void(0);" title="'+h.t+'" name="'+g+'" class="xheButton xheEnabled" tabindex="-1"><span class="'+p+'" unselectable="on" /></a></span>');h.s&&d.addShortcuts(h.s,g)}g.match(m)&&c.push('<span class="xheGStart"/>')});
c.push('<span class="xheGEnd"/><br />');Q.after(e('<input type="text" id="'+Ia+'" style="position:absolute;display:none;" /><span id="'+xa+'" class="xhe_'+o.skin+'" style="display:none"><table cellspacing="0" cellpadding="0" class="xheLayout" style="width:'+a+";height:"+U+'px;"><tbody><tr><td id="'+mb+'" class="xheTool" unselectable="on" style="height:1px;"></td></tr><tr><td id="'+nb+'" class="xheIframeArea"><iframe frameborder="0" id="'+ob+'" src="javascript:;" style="width:100%;"></iframe></td></tr></tbody></table></span>'));
M=e("#"+mb);O=e("#"+nb);ya='<meta content="text/html; charset=UTF-8" http-equiv="Content-Type"/><link rel="stylesheet" href="'+ab+'iframe.css"/>';if(a=o.loadCSS)if(ba(a,"array"))for(var n in a)ya+='<link rel="stylesheet" href="'+a[n]+'"/>';else ya+=a.match(/\s*<style(\s+[^>]*?)?>[\s\S]+?<\/style>\s*/i)?a:'<link rel="stylesheet" href="'+a+'"/>';n="<html><head>"+ya;if(b)n+="<style>body{background:"+b+";}</style>";n+='</head><body spellcheck="false" class="editMode'+na+'"></body></html>';d.win=ca=e("#"+
ob)[0].contentWindow;Z=e(ca);try{this.doc=w=ca.document;ua=e(w);w.open();w.write(n);w.close();if(y)w.body.contentEditable="true";else w.designMode="On"}catch(i){}setTimeout(Ua,300);d.setSource();ca.setInterval=null;M.append(c.join("")).bind("mousedown contextmenu",X).mousedown(function(f){var g=e(f.target).closest("a");if(g.is(".xheEnabled")){R=f;d.exec(g.attr("name"))}return false});M.find(".xheButton").hover(function(f){var g=e(this),l=o.hoverExecDelay,k=da;da=null;if(l===-1||wa||!g.is(".xheEnabled"))return false;
if(k&&k>10){wa=true;setTimeout(function(){wa=false},100);return false}var q=g.attr("name");if(qa[q].h!==1){d.hidePanel();return false}if($a)l=0;if(l>=0)Za=setTimeout(function(){R=f;ma={x:R.clientX,y:R.clientY};d.exec(q)},l)},function(){ma=null;Za&&clearTimeout(Za)}).mousemove(function(f){if(ma){var g={x:f.clientX-ma.x,y:f.clientY-ma.y};if(Math.abs(g.x)>1||Math.abs(g.y)>1){if(g.x>0&&g.y>0){g=Math.round(Math.atan(g.y/g.x)/0.017453293);da=da?(da+g)/2:g}else da=null;ma={x:f.clientX,y:f.clientY}}}});N=
e("#xhePanel");oa=e("#xheShadow");pa=e("#xheCntLine");if(N.length===0){N=e('<div id="xhePanel"></div>').mousedown(function(f){f.stopPropagation()});oa=e('<div id="xheShadow"></div>');pa=e('<div id="xheCntLine"></div>');setTimeout(function(){e(document.body).append(N).append(oa).append(pa)},10)}e("#"+xa).show();Q.hide();O.css("height",U-M.outerHeight());y&Ba<8&&setTimeout(function(){O.css("height",U-M.outerHeight())},1);Q.focus(d.focus);ib.submit(ra).bind("reset",eb);e(window).bind("unload beforeunload",
ra).bind("resize",Wa);e(document).mousedown(Xa);if(!db){e(document).keydown(Ma);db=true}Z.focus(function(){o.focus&&o.focus()}).blur(function(){o.blur&&o.blur()});V&&Z.click(Eb);ua.mousedown(Xa).keydown(Fb).keypress(Db).dblclick(I).bind("mousedown click",function(f){Q.trigger(f.type)});if(y){ua.keydown(function(f){var g=d.getRng();if(f.which===8&&g.item){e(g.item(0)).remove();return false}});var j=function(f){f=e(f.target);var g;if(g=f.css("width"))f.css("width","").attr("width",g.replace(/[^0-9%]+/g,
""));if(g=f.css("height"))f.css("height","").attr("height",g.replace(/[^0-9%]+/g,""))};ua.bind("controlselect",function(f){f=f.target;e.nodeName(f,"IMG")&&e(f).unbind("resizeend",j).bind("resizeend",j)})}b=e(w.documentElement);cb?b.bind("keydown",function(f){f.ctrlKey&&f.which===86&&fb()}):b.bind("paste",fb);o.disableContextmenu&&b.bind("contextmenu",X);o.html5Upload&&b.bind("dragenter dragover",function(f){var g;if((g=f.originalEvent.dataTransfer.types)&&e.inArray("Files",g)!==-1)return false}).bind("drop",
function(f){f=f.originalEvent.dataTransfer;var g;if(f&&(g=f.files)&&g.length>0){var l,k;f=["Link","Img","Flash","Media"];var q=[],r;for(l in f){k=f[l];o["up"+k+"Url"]&&o["up"+k+"Url"].match(/^[^!].*/i)&&q.push(k+":,"+o["up"+k+"Ext"])}if(q.length===0)return false;else r=q.join(",");k=function(u){var s,t;for(l=0;l<u.length;l++){s=u[l].fileName.replace(/.+\./,"");if(s=r.match(RegExp("(\\w+):[^:]*,"+s+"(?:,|$)","i")))if(t){if(t!==s[1])return 2}else t=s[1];else return 1}return t}(g);if(k===1)alert("Upload file extension required for this: "+
r.replace(/\w+:,/g,""));else if(k===2)alert("You can only drag and drop the same type of file.");else k&&d.startUpload(g,o["up"+k+"Url"],"*",function(u){var s=[],t;(t=o.onUpload)&&t(u);for(l in u){t=u[l];url=ba(t,"string")?t:t.url;if(url.substr(0,1)==="!")url=url.substr(1);s.push(url)}d.exec(k);e("#xhe"+k+"Url").val(s.join(" "));e("#xheSave").click()});return false}});(b=o.shortcuts)&&e.each(b,function(f,g){d.addShortcuts(f,g)});ia++;Va=true;if(o.fullscreen)d.toggleFullscreen();else o.sourceMode&&
setTimeout(d.toggleSource,20);return true};this.remove=function(){d.hidePanel();ra();Q.unbind("focus",d.focus);ib.unbind("submit",ra).unbind("reset",eb);e(window).unbind("unload beforeunload",ra).unbind("resize",Wa);e(document).unbind("mousedown",Xa);e("#"+xa).remove();e("#"+Ia).remove();Q.show();Va=false};this.saveBookmark=function(){if(!H){var a=d.getRng();a=a.cloneRange?a.cloneRange():a;la={top:Z.scrollTop(),rng:a}}};this.loadBookmark=function(){if(!(H||!la)){d.focus();var a=la.rng;if(y)a.select();
else{var b=d.getSel();b.removeAllRanges();b.addRange(a)}Z.scrollTop(la.top);la=null}};this.focus=function(){H?e("#sourceCode",w).focus():(y?ua:Z).focus();if(y){var a=d.getRng();a.parentElement&&a.parentElement().ownerDocument!==w&&d.setCursorFirst()}return false};this.setCursorFirst=function(a){ca.scrollTo(0,0);var b=d.getRng(true),c=w.body,h=c,p;if(a&&h.firstChild&&(p=h.firstChild.tagName)&&p.match(/^p|div|h[1-6]$/i))h=c.firstChild;y?b.moveToElementText(h):b.setStart(h,0);b.collapse(true);if(y)b.select();
else{a=d.getSel();a.removeAllRanges();a.addRange(b)}};this.getSel=function(){return w.selection?w.selection:ca.getSelection()};this.getRng=function(a){var b,c;try{if(!a){b=d.getSel();c=b.createRange?b.createRange():b.rangeCount>0?b.getRangeAt(0):null}c||(c=w.body.createTextRange?w.body.createTextRange():w.createRange())}catch(h){}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(),h=true;h=!c||c.item?false:!b||c.boundingWidth===0||c.collapsed;if(a==="text")return h?"":c.text||(b.toString?b.toString():"");if(c.cloneContents){a=e("<div></div>");(c=c.cloneContents())&&a.append(c);c=a.html()}else c=ba(c.item)?c.item(0).outerHTML:ba(c.htmlText)?c.htmlText:
c.toString();if(h)c="";c=d.processHTML(c,"read");c=d.cleanHTML(c);return c=d.formatXHTML(c)};this.pasteHTML=function(a,b){if(H)return false;d.focus();a=d.processHTML(a,"write");var c=d.getSel(),h=d.getRng();if(b!==ha){if(h.item){var p=h.item(0);h=d.getRng(true);h.moveToElementText(p);h.select()}h.collapse(b)}a+="<"+(y?"img":"span")+' id="_xhe_temp" width="0" height="0" />';if(h.insertNode){h.deleteContents();h.insertNode(h.createContextualFragment(a))}else{if(c.type.toLowerCase()==="control"){c.clear();
h=d.getRng()}h.pasteHTML(a)}p=e("#_xhe_temp",w);var m=p[0];if(y){h.moveToElementText(m);h.select()}else{h.selectNode(m);c.removeAllRanges();c.addRange(h)}p.remove()};this.pasteText=function(a,b){a||(a="");a=d.domEncode(a);a=a.replace(/\r?\n/g,"<br />");d.pasteHTML(a,b)};this.appendHTML=function(a){if(H)return false;d.focus();a=d.processHTML(a,"write");e(w.body).append(a)};this.domEncode=function(a){return a.replace(Cb,function(b){return Bb[b]})};this.setSource=function(a){la=null;if(typeof a!=="string"&&
a!=="")a=B.value;if(H)e("#sourceCode",w).val(a);else{if(o.beforeSetSource)a=o.beforeSetSource(a);a=d.cleanHTML(a);a=d.formatXHTML(a);a=d.processHTML(a,"write");if(y){w.body.innerHTML='<img id="_xhe_temp" width="0" height="0" />'+a+"\n";e("#_xhe_temp",w).remove()}else w.body.innerHTML=a}};this.processHTML=function(a,b){if(b==="write"){a=a.replace(/(<(\/?)(\w+))((?:\s+[\w-:]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*((\/?)>)/g,function(m,n,i,j,f,g,l){j=j.toLowerCase();if(Ca)if(j==="strong")j="b";else{if(j===
"em")j="i"}else if(V)if(j==="strong"){j="span";i||(f+=' class="Apple-style-span" style="font-weight: bold;"')}else if(j==="em"){j="span";i||(f+=' class="Apple-style-span" style="font-style: italic;"')}else if(j==="u"){j="span";i||(f+=' class="Apple-style-span" style="text-decoration: underline;"')}else if(j==="strike"){j="span";i||(f+=' class="Apple-style-span" style="text-decoration: line-through;"')}var k,q;if(j==="del")j="strike";else if(j==="img")f=f.replace(/\s+emot\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i,
function(u,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 o.emotMark?u:""});else if(j==="a"&&l)g="></a>";else if(j==="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(u,s,t){s=s.toLowerCase();t=t.match(/^(["']?)(.*)\1/)[2];aft="";if(y&&s.match(/^(disabled|checked|readonly|selected)$/)&&
t.match(/^(false|0)$/i))return"";if(j==="img"&&k&&s==="src")return"";if(s.match(/^(src|href)$/)){aft=" _xhe_"+s+'="'+t+'"';if(P)t=aa(t,"abs",P)}if(q&&s==="class"){t+=" "+q;q=""}if(V&&s==="style"){t=t.replace(/(^|;)\s*(font-size)\s*:\s*([a-z-]+)\s*(;|$)/i,function(C,K,z,G,D){for(var F,L=0;L<T.length;L++){C=T[L];if(G===C.n){F=C.wkn;break}}return K+z+":"+F+D});if(j==="span"&&t.match(/(^|;)\s*(font-family|font-size|color|background-color)\s*:\s*[^;]+\s*(;|$)/i))r=true}return" "+s+'="'+t+'"'+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+j+f+g});if(y)a=a.replace(/&apos;/ig,"&#39;");if(!V){var c=function(m,n,i,j){n="";var f,g;if(f=i.match(/font-family\s*:\s*([^;"]+)/i))n+=' face="'+f[1]+'"';if(f=i.match(/font-size\s*:\s*([^;"]+)/i)){f=f[1].toLowerCase();for(var l=0;l<T.length;l++)if(f===T[l].n||f===T[l].s){g=l+1;break}if(g){n+=' size="'+g+'"';i=i.replace(/(^|;)(\s*font-size\s*:\s*[^;"]+;?)+/ig,
"$1")}}if(g=i.match(/(?:^|[\s;])color\s*:\s*([^;"]+)/i)){if(f=g[1].match(/\s*rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i)){g[1]="#";for(l=1;l<=3;l++)g[1]+=(f[l]-0).toString(16)}g[1]=g[1].replace(/^#([0-9a-f])([0-9a-f])([0-9a-f])$/i,"#$1$1$2$2$3$3");n+=' color="'+g[1]+'"'}i=i.replace(/(^|;)(\s*(font-family|color)\s*:\s*[^;"]+;?)+/ig,"$1");if(n!==""){if(i)n+=' style="'+i+'"';return"<font"+n+">"+j+"</font>"}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|&nbsp;)*<\/\1>/ig,"<$1$2>"+(y?"":"<br />")+"</$1>")}else{if(V){var h=[{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,n,i,j,f){n=i+j;i="";if(!n)return f;for(j=0;j<h.length;j++)if(n.match(h[j].r)){i=h[j].t;break}return i?"<"+i+">"+f+"</"+i+">":m};for(var p=0;p<2;p++){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,n,i,j,f){i=i.toLowerCase();var g;j=j.replace(/\s+_xhe_(?:src|href)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i,function(l,
k){g=k.match(/^(["']?)(.*)\1/)[2];return""});if(g&&Fa)g=aa(g,Fa,P);j=j.replace(/\s+([\w-:]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/g,function(l,k,q){k=k.toLowerCase();q=q.match(/^(["']?)(.*)\1/)[2];if(k==="class"){if(q.match(/^["']?(apple|webkit)/i))return"";if(i==="table"){q=q.replace(/\s?xhe-border/ig,"");if(q==="")return""}}else if(k.match(/^((_xhe_|_moz_|_webkit_)|jquery\d+)/i))return"";else if(g&&k.match(/^(src|href)$/i))return" "+k+'="'+g+'"';else if(V&&k==="style")q=q.replace(/(^|;)\s*(font-size)\s*:\s*([a-z-]+)\s*(;|$)/i,
function(r,u,s,t,C){for(var K,z=0;z<T.length;z++){r=T[z];if(t===r.wkn){K=r.n;break}}return u+s+":"+K+C});return" "+k+'="'+q+'"'});if(i==="img"&&!j.match(/\s+alt\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/i))j+=' alt=""';return n+j+f});a=a.replace(/(<(td|th)(?:\s+[^>]*?)?>)\s*([\s\S]*?)(<br(\s*\/)?>)?\s*<\/\2>/ig,function(m,n,i,j){return n+(j?j:"&nbsp;")+"</"+i+">"});a=a.replace(/^\s*(?:<(p|div)(?:\s+[^>]*?)?>)?\s*(<span(?:\s+[^>]*?)?>\s*<\/span>|<br(?:\s+[^>]*?)?>|&nbsp;)*\s*(?:<\/\1>)?\s*$/i,"")}return a=a.replace(/(<pre(?:\s+[^>]*?)?>)([\s\S]+?)(<\/pre>)/gi,
function(m,n,i,j){return n+i.replace(/<br\s*\/?>/ig,"\r\n")+j})};this.getSource=function(a){var b,c=o.beforeGetSource;if(H){b=e("#sourceCode",w).val();c||(b=d.formatXHTML(b,false))}else{b=d.processHTML(w.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=o.cleanPaste;if(b>0&&b<3&&a.match(/mso(-|normal)|WordDocument|<table\s+[^>]*?x:str/i)){a=a.replace(/<!--[\s\S]*?--\>|<!(--)?\[[\s\S]+?\](--)?>|<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,
"");a=a.replace(/\r?\n/ig,"");a=a.replace(/(<(\/?)([\w-:]+))((?:\s+[\w-:]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))?)*)\s*(\/?>)/g,function(h,p,m,n,i,j){n=n.toLowerCase();if(n.match(/^(link|img)$/)&&i.match(/file:\/\//i)||n.match(/:/)||n==="span"&&b===2)return"";if(!m){i=i.replace(/\s([\w-:]+)(?:\s*=\s*("[^"]*"|'[^']*'|[^>\s]+))?/ig,function(f,g,l){g=g.toLowerCase();l=l.match(/^(["']?)(.*)\1/)[2];if(g.match(/:/))return"";else if(g.match(/^(class|lang|language|span)$/))return"";else if(n==="td"&&(g===
"height"||g==="width"&&!i.match(/\scolspan="\d+"/i)))return"";else if(g==="style"){if(b===2)return"";return(l=e.trim(l.replace(/\s*(mso-[^:]+:.+?|margin\s*:\s*0cm 0cm 0pt\s*|(text-align|font-variant|line-height)\s*:\s*.+?)(;|$)\s*/ig,"")))?" "+g+'="'+l+'"':""}return f});if(n==="a"&&!i.match(/\s+href\s*=/))return""}return p+i+j});for(var c=0;c<3;c++)a=a.replace(/<([^\s>]+)(\s+[^>]*)?>\s*<\/\1>/g,"")}return a};this.cleanHTML=function(a){a=a.replace(/<!?\/?(DOCTYPE|html|body|meta)(\s+[^>]*?)?>/ig,"");
var b;a=a.replace(/<head(?:\s+[^>]*?)?>([\s\S]*?)<\/head>/i,function(c,h){b=h.match(/<(script|style)(\s+[^>]*?)?>[\s\S]*?<\/\1>/ig);return""});if(b)a=b.join("")+a;a=a.replace(/<\??xml(:\w+)?(\s+[^>]*?)?>([\s\S]*?<\/xml>)?/ig,"");o.internalScript||(a=a.replace(/<script(\s+[^>]*?)?>[\s\S]*?<\/script>/ig,""));o.internalStyle||(a=a.replace(/<style(\s+[^>]*?)?>[\s\S]*?<\/style>/ig,""));if(!o.linkTag||!o.inlineScript||!o.inlineStyle)a=a.replace(/(<(\w+))((?:\s+[\w-]+\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))*)\s*(\/?>)/ig,
function(c,h,p,m,n){if(!o.linkTag&&p.toLowerCase()==="link")return"";o.inlineScript||(m=m.replace(/\s+on(?:click|dblclick|mouse(down|up|move|over|out|enter|leave|wheel)|key(down|press|up)|change|select|submit|reset|blur|focus|load|unload)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/ig,""));o.inlineStyle||(m=m.replace(/\s+(style|class)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)/ig,""));return h+m+n});return a=a.replace(/<\/(strong|b|u|strike|em|i)>((?:\s|<br\/?>|&nbsp;)*?)<\1(\s+[^>]*?)?>/ig,"$2")};this.formatXHTML=function(a,
b){function c(v){var x={};v=v.split(",");for(var A=0;A<v.length;A++)x[v[A]]=true;return x}function h(v){v=v.toLowerCase();var x=t[v];return x?x:v}function p(v,x,A){if(k[v])for(;G.last()&&q[G.last()];)m(G.last());r[v]&&G.last()===v&&m(v);(A=l[v]||!!A)||G.push(v);var J=[];J.push("<"+v);x.replace(K,function(pb,za,qb,rb,sb){za=za.toLowerCase();J.push(" "+za+'="'+(qb?qb:rb?rb:sb?sb:u[za]?za:"")+'"')});J.push((A?" /":"")+">");j(J.join(""),v,true);if(v==="pre")Ka=true}function m(v){if(v)for(x=G.length-1;x>=
0;x--){if(G[x]===v)break}else var x=0;if(x>=0){for(var A=G.length-1;A>=x;A--)j("</"+G[A]+">",G[A]);G.length=x}if(v==="pre"){Ka=false;fa--}}function n(v){j(d.domEncode(v))}function i(v){z.push(v)}function j(v,x,A){Ka||(v=v.replace(/(\t*\r?\n\t*)+/g,""));if(!Ka&&b===true)if(v.match(/^\s*$/))z.push(v);else{var J=k[x],pb=J?x:"";if(J){A&&fa++;La===""&&fa--}else La&&fa++;if(pb!==La||J)f();z.push(v);x==="br"&&f();if(J&&(l[x]||!A))fa--;La=J?x:""}else z.push(v)}function f(){z.push("\r\n");if(fa>0)for(var v=
fa;v--;)z.push("\t")}function g(v,x,A,J){if(!A)return J;v="";if(x=A.match(/ face\s*=\s*"\s*([^"]+)\s*"/i))v+="font-family:"+x[1]+";";if(x=A.match(/ size\s*=\s*"\s*(\d+)\s*"/i))v+="font-size:"+T[(x[1]>7?7:x[1]<1?1:x[1])-1].n+";";if(x=A.match(/ color\s*=\s*"\s*([^"]+)\s*"/i))v+="color:"+x[1]+";";if(A=A.match(/ style\s*=\s*"\s*([^"]+)\s*"/i))v+=A[1];if(v)J='<span style="'+v+'">'+J+"</span>";return J}var l=c("area,base,basefont,br,col,frame,hr,img,input,isindex,link,meta,param"),k=c("address,applet,blockquote,button,center,dd,del,dir,div,dl,dt,fieldset,form,frameset,h1,h2,h3,h4,h5,h6,hr,iframe,ins,isindex,li,map,menu,noframes,noscript,object,ol,p,pre,script,table,tbody,td,tfoot,th,thead,tr,ul"),
q=c("a,abbr,acronym,applet,b,basefont,bdo,big,br,button,cite,code,del,dfn,em,font,i,iframe,img,input,ins,kbd,label,map,object,q,s,samp,script,select,small,span,strike,strong,sub,sup,textarea,tt,u,var"),r=c("colgroup,dd,dt,li,options,p,td,tfoot,th,thead,tr"),u=c("checked,compact,declare,defer,disabled,ismap,multiple,nohref,noresize,noshade,nowrap,readonly,selected"),s=c("script,style"),t={b:"strong",i:"em",s:"del",strike:"del"},C=/<(?:\/([\w:]+)|!--([^>]*?)--|([\w:]+)((?:\s+[\w-:]+(?:\s*=\s*(?:"[^"]*"|'[^']*'|[^>\s]+))?)*)\s*(\/?))>/g,
K=/\s+([\w-:]+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s]+)))?/g,z=[],G=[];G.last=function(){return this[this.length-1]};for(var D,F,L=0,ga,Aa,fa=-1,La="body",Ka=false;D=C.exec(a);){F=D.index;if(F>L){L=a.substring(L,F);ga?Aa.push(L):n(L)}L=C.lastIndex;if(F=D[1]){F=h(F);if(ga&&F===ga){i(Aa.join(""));Aa=ga=null}if(!ga){m(F);continue}}if(ga)Aa.push(D[0]);else if(F=D[3]){F=h(F);p(F,D[4],D[5]);if(s[F]){ga=F;Aa=[]}}else D[2]&&z.push(D[0])}a.length>L&&n(a.substring(L,a.length));m();a=z.join("");z=null;a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?<\/\1>)*?)<\/\1>/ig,
g);a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S]|<\1(\s+[^>]*?)?>((?!<\1(\s+[^>]*?)?>)[\s\S])*?<\/\1>)*?)<\/\1>/ig,g);a=a.replace(/<(font)(\s+[^>]*?)?>(((?!<\1(\s+[^>]*?)?>)[\s\S])*?)<\/\1>/ig,g);return a=a.replace(/^(\s*\r?\n)+|(\s*\r?\n)+$/g,"")};this.toggleShowBlocktag=function(a){if(va!==a){va=!va;a=e(w.body);if(va){na+=" showBlocktag";a.addClass("showBlocktag")}else{na=na.replace(" showBlocktag","");a.removeClass("showBlocktag")}}};this.toggleSource=function(a){if(H!==a){M.find("[name=Source]").toggleClass("xheEnabled").toggleClass("xheActive");
var b=w.body,c=e(b),h,p;a=0;if(H){h=d.getSource();c.html("").removeAttr("scroll").attr("class","editMode"+na);if(y)b.contentEditable="true";else w.designMode="On";if(Ca){d._exec("inserthtml","-");e("#"+Ia).show().focus().hide()}}else{d.pasteHTML('<span id="_xhe_cursor"></span>',true);h=d.getSource(true);a=h.indexOf('<span id="_xhe_cursor"></span>');if(!cb)a=h.substring(0,a).replace(/\r/g,"").length;h=h.replace('<span id="_xhe_cursor"></span>',"");if(y)b.contentEditable="false";else w.designMode="Off";
c.attr("scroll","no").attr("class","sourceMode").html('<textarea id="sourceCode" wrap="soft" spellcheck="false" height="100%" />');p=e("#sourceCode",c).blur(d.getSource)[0]}H=!H;d.setSource(h);d.focus();if(H)if(p.setSelectionRange)p.setSelectionRange(a,a);else{p=p.createTextRange();p.move("character",a);p.select()}else d.setCursorFirst(true);M.find("[name=Source],[name=Preview]").toggleClass("xheEnabled");M.find(".xheButton").not("[name=Source],[name=Fullscreen],[name=About]").toggleClass("xheEnabled");
setTimeout(Ua,300)}};this.showPreview=function(){var a=o.beforeSetSource,b=d.getSource();if(a)b=a(b);a="<html><head>"+ya+"<title>Preview</title>"+(P?'<base href="'+P+'"/>':"")+"</head><body>"+b+"</body></html>";b=window.screen;b=window.open("","xhePreview","toolbar=yes,location=no,status=yes,menubar=yes,scrollbars=yes,resizable=yes,width="+Math.round(b.width*0.9)+",height="+Math.round(b.height*0.8)+",left="+Math.round(b.width*0.05));var c=b.document;c.open();c.write(a);c.close();b.focus()};this.toggleFullscreen=
function(a){if(sa!==a){a=e("#"+xa).find(".xheLayout");var b=e("#"+xa),c=jQuery.browser.version;c=y&&(c==6||c==7);if(sa){c&&Q.after(b);a.attr("style",jb);O.height(U-M.outerHeight());e(window).scrollTop(Ya);setTimeout(function(){e(window).scrollTop(Ya)},10)}else{c&&e("body").append(b);Ya=e(window).scrollTop();jb=a.attr("style");a.removeAttr("style");O.height("100%");setTimeout(Wa,100)}if(Ca){e("#"+Ia).show().focus().hide();setTimeout(d.focus,1)}else c&&d.setCursorFirst();sa=!sa;b.toggleClass("xhe_Fullscreen");
e("html").toggleClass("xhe_Fullfix");M.find("[name=Fullscreen]").toggleClass("xheActive");setTimeout(Ua,300)}};this.showMenu=function(a,b){var c=e('<div class="xheMenu"></div>'),h=[];e.each(a,function(p,m){h.push('<a href="javascript:void(0);" title="'+(m.t?m.t:m.s)+'" v="'+m.v+'">'+m.s+"</a>")});c.append(h.join(""));c.click(function(p){b(e(p.target).closest("a").attr("v"));d.hidePanel();return false}).mousedown(X);d.showPanel(c)};this.showColor=function(a){var b=e('<div class="xheColor"></div>'),
c=[],h=0;e.each(ub,function(p,m){if(h%7===0)c.push((h>0?"</div>":"")+"<div>");c.push('<a href="javascript:void(0);" xhev="'+m+'" title="'+m+'" style="background:'+m+'"></a>');h++});c.push("</div>");b.append(c.join(""));b.click(function(p){p=p.target;if(e.nodeName(p,"A")){a(e(p).attr("xhev"));d.hidePanel();return false}}).mousedown(X);d.showPanel(b)};this.showPastetext=function(){var a=e('<div>Use Ctrl+V on your keyboard to paste the text.</div><div><textarea id="xhePastetextValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>'),
b=e("#xhePastetextValue",a);e("#xheSave",a).click(function(){d.loadBookmark();var c=b.val();c&&d.pasteText(c);d.hidePanel();return false});d.showDialog(a)};this.showLink=function(){var a=e('<div>Link URL: <input type="text" id="xheLinkUrl" value="http://" class="xheText" /></div><div>Target:&nbsp;&nbsp; <select id="xheLinkTarget"><option selected="selected" value="">Default</option><option value="_blank">New window</option><option value="_self">Same window</option><option value="_parent">Parent window</option></select></div><div style="display:none">Link Text:<input type="text" id="xheLinkText" value="" class="xheText" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>'),
b=d.getParent("a"),c=e("#xheLinkText",a),h=e("#xheLinkUrl",a),p=e("#xheLinkTarget",a),m=e("#xheSave",a),n=d.getSelect();if(b.length===1){h.val($(b,"href"));p.attr("value",b.attr("target"))}else n===""&&c.val(o.defLinkText).closest("div").show();o.upLinkUrl&&d.uploadInit(h,o.upLinkUrl,o.upLinkExt);m.click(function(){d.loadBookmark();var i=h.val();if(i===""||b.length===0)d._exec("unlink");if(i!==""&&i!=="http://"){var j=i.split(" "),f=p.val(),g=c.val();if(j.length>1){d._exec("unlink");n=d.getSelect();
var l='<a href="xhe_tmpurl"',k=[];if(f!=="")l+=' target="'+f+'"';l+=">xhe_tmptext</a>";g=n!==""?n:g?g:i;for(var q in j){i=j[q];if(i!==""){i=i.split("||");f=l;f=f.replace("xhe_tmpurl",i[0]);f=f.replace("xhe_tmptext",i[1]?i[1]:g);k.push(f)}}d.pasteHTML(k.join("&nbsp;"))}else{i=j[0].split("||");g||(g=i[0]);g=i[1]?i[1]:n!==""?"":g?g:i[0];if(b.length===0){g?d.pasteHTML('<a href="#xhe_tmpurl">'+g+"</a>"):d._exec("createlink","#xhe_tmpurl");b=e('a[href$="#xhe_tmpurl"]',w)}else g&&!V&&b.text(g);$(b,"href",
i[0]);f!==""?b.attr("target",f):b.removeAttr("target")}}d.hidePanel();return false});d.showDialog(a)};this.showImg=function(){var a=e('<div>Img URL:&nbsp; <input type="text" id="xheImgUrl" value="http://" class="xheText" /></div><div>Alt text: <input type="text" id="xheImgAlt" /></div><div>Alignment:<select id="xheImgAlign"><option selected="selected" value="">Default</option><option value="left">Left</option><option value="right">Right</option><option value="top">Top</option><option value="middle">Middle</option><option value="baseline">Baseline</option><option value="bottom">Bottom</option></select></div><div>Dimension:<input type="text" id="xheImgWidth" style="width:40px;" /> x <input type="text" id="xheImgHeight" style="width:40px;" /></div><div>Border:&nbsp;&nbsp;&nbsp;<input type="text" id="xheImgBorder" style="width:40px;" /></div><div>Hspace:&nbsp;&nbsp;&nbsp;<input type="text" id="xheImgHspace" style="width:40px;" /> Vspace:<input type="text" id="xheImgVspace" style="width:40px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>'),
b=d.getParent("img"),c=e("#xheImgUrl",a),h=e("#xheImgAlt",a),p=e("#xheImgAlign",a),m=e("#xheImgWidth",a),n=e("#xheImgHeight",a),i=e("#xheImgBorder",a),j=e("#xheImgVspace",a),f=e("#xheImgHspace",a),g=e("#xheSave",a);if(b.length===1){c.val($(b,"src"));h.val(b.attr("alt"));p.val(b.attr("align"));m.val(b.attr("width"));n.val(b.attr("height"));i.val(b.attr("border"));var l=b.attr("vspace"),k=b.attr("hspace");j.val(l<=0?"":l);f.val(k<=0?"":k)}o.upImgUrl&&d.uploadInit(c,o.upImgUrl,o.upImgExt);g.click(function(){d.loadBookmark();
var q=c.val();if(q!==""&&q!=="http://"){var r=q.split(" "),u=h.val(),s=p.val(),t=m.val(),C=n.val(),K=i.val(),z=j.val(),G=f.val();if(r.length>1){var D='<img src="xhe_tmpurl"',F=[];if(u!=="")D+=' alt="'+u+'"';if(s!=="")D+=' align="'+s+'"';if(t!=="")D+=' width="'+t+'"';if(C!=="")D+=' height="'+C+'"';if(K!=="")D+=' border="'+K+'"';if(z!=="")D+=' vspace="'+z+'"';if(G!=="")D+=' hspace="'+G+'"';D+=" />";for(var L in r){q=r[L];if(q!==""){q=q.split("||");u=D;u=u.replace("xhe_tmpurl",q[0]);if(q[1])u='<a href="'+
q[1]+'" target="_blank">'+u+"</a>";F.push(u)}}d.pasteHTML(F.join("&nbsp;"))}else if(r.length===1){q=r[0];if(q!==""){q=q.split("||");if(b.length===0){d.pasteHTML('<img src="'+q[0]+'#xhe_tmpurl" />');b=e('img[src$="#xhe_tmpurl"]',w)}$(b,"src",q[0]);u!==""&&b.attr("alt",u);s!==""?b.attr("align",s):b.removeAttr("align");t!==""?b.attr("width",t):b.removeAttr("width");C!==""?b.attr("height",C):b.removeAttr("height");K!==""?b.attr("border",K):b.removeAttr("border");z!==""?b.attr("vspace",z):b.removeAttr("vspace");
G!==""?b.attr("hspace",G):b.removeAttr("hspace");if(q[1]){r=b.parent("a");if(r.length===0){b.wrap("<a></a>");r=b.parent("a")}$(r,"href",q[1]);r.attr("target","_blank")}}}}else b.length===1&&b.remove();d.hidePanel();return false});d.showDialog(a)};this.showEmbed=function(a,b,c,h,p,m,n){b=e(b);var i=d.getParent('embed[type="'+c+'"],embed[classid="'+h+'"]'),j=e("#xhe"+a+"Url",b),f=e("#xhe"+a+"Width",b),g=e("#xhe"+a+"Height",b);a=e("#xheSave",b);m&&d.uploadInit(j,m,n);d.showDialog(b);if(i.length===1){j.val($(i,
"src"));f.val(i.attr("width"));g.val(i.attr("height"))}a.click(function(){d.loadBookmark();var l=j.val();if(l!==""&&l!=="http://"){var k=f.val(),q=g.val(),r=/^\d+%?$/;r.test(k)||(k=412);r.test(q)||(q=300);var u='<embed type="'+c+'" classid="'+h+'" src="xhe_tmpurl"'+p;r=l.split(" ");if(r.length>1){u=u+"";var s,t=[];u+=' width="xhe_width" height="xhe_height" />';for(var C in r){l=r[C].split("||");s=u;s=s.replace("xhe_tmpurl",l[0]);s=s.replace("xhe_width",l[1]?l[1]:k);s=s.replace("xhe_height",l[2]?l[2]:
q);l!==""&&t.push(s)}d.pasteHTML(t.join("&nbsp;"))}else if(r.length===1){l=r[0].split("||");if(i.length===0){d.pasteHTML(u.replace("xhe_tmpurl",l[0]+"#xhe_tmpurl")+" />");i=e('embed[src$="#xhe_tmpurl"]',w)}$(i,"src",l[0]);i.attr("width",l[1]?l[1]:k);i.attr("height",l[2]?l[2]:q)}}else i.length===1&&i.remove();d.hidePanel();return false})};this.showEmot=function(a){var b=e('<div class="xheEmot"></div>');a=a?a:bb?bb:"default";var c=Ja[a],h=ea+a+"/",p=0,m=[],n="";n=c.width;var i=c.height,j=c.line,f=c.count;
c=c.list;if(f)for(c=1;c<=f;c++){p++;m.push('<a href="javascript:void(0);" style="background-image:url('+h+c+'.gif);" emot="'+a+","+c+'" xhev="">&nbsp;</a>');p%j===0&&m.push("<br />")}else e.each(c,function(k,q){p++;m.push('<a href="javascript:void(0);" style="background-image:url('+h+k+'.gif);" emot="'+a+","+k+'" title="'+q+'" xhev="'+q+'">&nbsp;</a>');p%j===0&&m.push("<br />")});f=j*(n+12);c=f*0.75;if(Math.ceil(p/j)*(i+12)<=c)c="";n=e("<style>"+(c?".xheEmot div{width:"+(f+20)+"px;height:"+c+"px;}":
"")+".xheEmot div a{width:"+n+"px;height:"+i+"px;}</style><div>"+m.join("")+"</div>").click(function(k){k=k.target;var q=e(k);if(e.nodeName(k,"A")){d.pasteHTML('<img emot="'+q.attr("emot")+'" alt="'+q.attr("xhev")+'">');d.hidePanel();return false}}).mousedown(X);b.append(n);var g=0,l=["<ul>"];e.each(Ja,function(k,q){g++;l.push("<li"+(a===k?' class="cur"':"")+'><a href="javascript:void(0);" group="'+k+'">'+q.name+"</a></li>")});if(g>1){l.push('</ul><br style="clear:both;" />');n=e(l.join("")).click(function(k){bb=
e(k.target).attr("group");d.exec("Emot");return false}).mousedown(X);b.append(n)}d.showPanel(b)};this.showTable=function(){var a=e('<div>Rows&Cols:&nbsp;&nbsp;<input type="text" id="xheTableRows" style="width:40px;" value="3" /> x <input type="text" id="xheTableColumns" style="width:40px;" value="2" /></div><div>Headers:&nbsp;&nbsp;&nbsp;&nbsp;<select id="xheTableHeaders"><option selected="selected" value="">None</option><option value="row">First row</option><option value="col">First column</option><option value="both">Both</option></select></div><div>Dimension:&nbsp;&nbsp;<input type="text" id="xheTableWidth" style="width:40px;" value="200" /> x <input type="text" id="xheTableHeight" style="width:40px;" value="" /></div><div>Border:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" id="xheTableBorder" style="width:40px;" value="1" /></div><div>CellSpacing:<input type="text" id="xheTableCellSpacing" style="width:40px;" value="1" /> CellPadding:<input type="text" id="xheTableCellPadding" style="width:40px;" value="1" /></div><div>Align:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<select id="xheTableAlign"><option selected="selected" value="">Default</option><option value="left">Left</option><option value="center">Center</option><option value="right">Right</option></select></div><div>Caption:&nbsp;&nbsp;&nbsp;&nbsp;<input type="text" id="xheTableCaption" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>'),
b=e("#xheTableRows",a),c=e("#xheTableColumns",a),h=e("#xheTableHeaders",a),p=e("#xheTableWidth",a),m=e("#xheTableHeight",a),n=e("#xheTableBorder",a),i=e("#xheTableCellSpacing",a),j=e("#xheTableCellPadding",a),f=e("#xheTableAlign",a),g=e("#xheTableCaption",a);e("#xheSave",a).click(function(){d.loadBookmark();var l=g.val(),k=n.val(),q=b.val(),r=c.val(),u=h.val(),s=p.val(),t=m.val(),C=i.val(),K=j.val(),z=f.val();k="<table"+(k!==""?' border="'+k+'"':"")+(s!==""?' width="'+s+'"':"")+(t!==""?' width="'+
t+'"':"")+(C!==""?' cellspacing="'+C+'"':"")+(K!==""?' cellpadding="'+K+'"':"")+(z!==""?' align="'+z+'"':"")+">";if(l!=="")k+="<caption>"+l+"</caption>";if(u==="row"||u==="both"){k+="<tr>";for(l=0;l<r;l++)k+='<th scope="col"></th>';k+="</tr>";q--}k+="<tbody>";for(l=0;l<q;l++){k+="<tr>";for(s=0;s<r;s++)k+=s===0&&(u==="col"||u==="both")?'<th scope="row"></th>':"<td></td>";k+="</tr>"}k+="</tbody></table>";d.pasteHTML(k);d.hidePanel();return false});d.showDialog(a)};this.showAbout=function(){var a=e('<div style="font:12px Arial;width:245px;word-wrap:break-word;word-break:break-all;"><p><span style="font-size:20px;color:#1997DF;">xhEditor</span><br />v1.1.6 (build 110411)</p><p>xhEditor is a platform independent WYSWYG XHTML editor based by jQuery,released as Open Source under <a href="http://www.gnu.org/licenses/lgpl.html" target="_blank">LGPL</a>.</p><p>Copyright &copy; <a href="http://xheditor.com/" target="_blank">xhEditor.com</a>. All rights reserved.</p></div>');
d.showDialog(a)};this.addShortcuts=function(a,b){a=a.toLowerCase();if(ta[a]===ha)ta[a]=[];ta[a].push(b)};this.delShortcuts=function(a){delete ta[a]};this.uploadInit=function(a,b,c){function h(f){if(ba(f,"string"))f=[f];var g=false,l,k=f.length,q,r=[];(l=o.onUpload)&&l(f);for(l=0;l<k;l++){q=f[l];q=ba(q,"string")?q:q.url;if(q.substr(0,1)==="!"){g=true;q=q.substr(1)}r.push(q)}a.val(r.join(" "));g&&a.closest(".xheDialog").find("#xheSave").click()}var p=e('<span class="xheUpload"><input type="text" style="visibility:hidden;" tabindex="-1" /><input type="button" value="'+
o.upBtnText+'" class="xheBtn" tabindex="-1" /></span>'),m=e(".xheBtn",p),n=o.html5Upload,i=n?o.upMultiple:1;a.after(p);m.before(a);b=b.replace(/{editorRoot}/ig,W);if(b.substr(0,1)==="!")m.click(function(){S=false;d.showIframeModal("Upload file",b.substr(1),h,null,null,function(){S=true})});else{p.append('<input type="file"'+(i>1?' multiple=""':"")+' class="xheFile" size="13" name="filedata" tabindex="-1" />');var j=e(".xheFile",p);j.change(function(){d.startUpload(j[0],b,c,h)});setTimeout(function(){a.closest(".xheDialog").bind("dragenter dragover",
X).bind("drop",function(f){f=f.originalEvent.dataTransfer;var g;if(n&&f&&(g=f.files)&&g.length>0)d.startUpload(g,b,c,h);return false})},10)}};this.startUpload=function(a,b,c,h){function p(r,u){var s=Object,t=false;try{s=eval("("+r+")")}catch(C){}if(s.err===ha||s.msg===ha)alert(b+" upload interface error!\r\n\r\nreturn error:\r\n\r\n"+r);else if(s.err)alert(s.err);else{m.push(s.msg);t=true}if(!t||u)d.removeModal();u&&t&&h(m);return t}var m=[],n=o.html5Upload,i=n?o.upMultiple:1,j,f,g=e('<div style="padding:22px 0;text-align:center;line-height:30px;">File uploading,please wait...<br /></div>'),
l='<img src="'+ab+'img/loading.gif">';if(!n||a.nodeType&&!((f=a.files)&&f[0])){if(!gb(a.value,c))return;g.append(l);j=new d.html4Upload(a,b,p)}else{f||(f=a);a=f.length;if(a>i){alert("Please do not upload more then "+i+" files.");return}for(i=0;i<a;i++)if(!gb(f[i].fileName,c))return;var k=e('<div class="xheProgress"><div><span>0%</span></div></div>');g.append(k);j=new d.html5Upload("filedata",f,b,p,function(r){if(r.loaded>=0){var u=Math.round(r.loaded*100/r.total)+"%";e("div",k).css("width",u);e("span",
k).text(u+" ( "+hb(r.loaded)+" / "+hb(r.total)+" )")}else k.replaceWith(l)})}var q=S;if(q)S=false;d.showModal("File uploading(Esc cancel)",g,320,150,function(){S=q;j.remove()});j.start()};this.html4Upload=function(a,b,c){var h="jUploadFrame"+(new Date).getTime(),p=this,m=e('<iframe name="'+h+'" class="xheHideArea" />').appendTo("body"),n=e('<form action="'+b+'" target="'+h+'" method="post" enctype="multipart/form-data" class="xheHideArea"></form>').appendTo("body"),i=e(a),j=i.clone().attr("disabled",
"true");i.before(j).appendTo(n);this.remove=function(){if(p!==null){j.before(i).remove();m.remove();n.remove();p=null}};this.onLoad=function(){var f=m[0].contentWindow.document,g=e(f.body).text();f.write("");c(g,true)};this.start=function(){n.submit();m.load(p.onLoad)};return this};this.html5Upload=function(a,b,c,h,p){function m(r,u,s,t){i=new XMLHttpRequest;upload=i.upload;i.onreadystatechange=function(){i.readyState===4&&s(i.responseText)};if(upload)upload.onprogress=function(C){t(C.loaded)};else t(-1);
i.open("POST",u);i.setRequestHeader("Content-Type","application/octet-stream");i.setRequestHeader("Content-Disposition",'attachment; name="'+a+'"; filename="'+r.fileName+'"');i.sendAsBinary?i.sendAsBinary(r.getAsBinary()):i.send(r)}function n(r){p&&p({loaded:g+r,total:l})}for(var i,j=0,f=b.length,g=0,l=0,k=this,q=0;q<f;q++)l+=b[q].fileSize;this.remove=function(){if(i){i.abort();i=null}};this.uploadNext=function(r){if(r){g+=b[j-1].fileSize;n(0)}if((!r||r&&h(r,j===f)===true)&&j<f)m(b[j++],c,k.uploadNext,
function(u){n(u)})};this.start=function(){k.uploadNext()}};this.showIframeModal=function(a,b,c,h,p,m){function n(){try{g.callback=i;g.unloadme=d.removeModal}catch(k){}}function i(k){d.removeModal();k!=null&&c(k)}b=e('<iframe frameborder="0" src="'+b.replace(/{editorRoot}/ig,W)+(/\?/.test(b)?"&":"?")+"editorhost="+location.hostname+'" style="width:100%;height:100%;display:none;" /><div class="xheModalIfmWait"></div>');var j=e(b[0]),f=e(b[1]);d.showModal(a,b,h,p,m);var g=j[0].contentWindow,l;n();j.load(function(){try{if(l=
g.name){g.document.write("");l=eval("("+unescape(l)+")");return i(l)}else{n();e(g.document).keydown(Ma)}}catch(k){}if(f.is(":visible")){j.show();f.remove()}})};this.showModal=function(a,b,c,h,p){if(Ea)return false;ka=o.layerShadow;c=c?c:o.modalWidth;h=h?h:o.modalHeight;Y=e('<div class="xheModal" style="width:'+(c-1)+"px;height:"+h+"px;margin-left:-"+Math.ceil(c/2)+"px;"+(y&&Ba<=7?"":"margin-top:-"+Math.ceil(h/2)+"px")+'">'+(o.modalTitle?'<div class="xheModalTitle"><span class="xheModalClose" title="Close (Esc)"></span>'+
a+"</div>":"")+'<div class="xheModalContent"></div></div>').appendTo("body");Oa=e('<div class="xheModalOverlay"></div>').appendTo("body");if(ka>0)Na=e('<div class="xheModalShadow" style="width:'+Y.outerWidth()+"px;height:"+Y.outerHeight()+"px;margin-left:-"+(Math.ceil(c/2)-ka-2)+"px;"+(y&&Ba<=7?"":"margin-top:-"+(Math.ceil(h/2)-ka-2)+"px")+'"></div>').appendTo("body");e(".xheModalContent",Y).css("height",h-(o.modalTitle?e(".xheModalTitle").outerHeight():0)).html(b);if(y&&Ba===6)Pa=e("select:visible").css("visibility",
"hidden");e(".xheModalClose",Y).click(d.removeModal);Oa.show();ka>0&&Na.show();Y.show();Ea=true;Qa=p};this.removeModal=function(){Pa&&Pa.css("visibility","visible");Y.html("").remove();ka>0&&Na.remove();Oa.remove();Qa&&Qa();Ea=false};this.showDialog=function(a){var b=e('<div class="xheDialog"></div>');a=e(a);var c=e("#xheSave",a);if(c.length===1){a.find("input[type=text],select").keypress(function(m){if(m.which===13){c.click();return false}});a.find("textarea").keydown(function(m){if(m.ctrlKey&&m.which===
13){c.click();return false}});c.after(' <input type="button" id="xheCancel" value="Cancel" />');e("#xheCancel",a).click(d.hidePanel);if(!o.clickCancelDialog){Da=false;var h=e('<div class="xheFixCancel"></div>').appendTo("body").mousedown(X),p=O.offset();h.css({left:p.left,top:p.top,width:O.outerWidth(),height:O.outerHeight()})}b.mousedown(function(){wa=true})}b.append(a);d.showPanel(b);y||setTimeout(function(){b.find("input[type=text],textarea").filter(":visible").filter(function(){return e(this).css("visibility")!==
"hidden"}).eq(0).focus()},10)};this.showPanel=function(a){if(!R.target)return false;N.html("").append(a).css("left",-999).css("top",-999);ja=e(R.target).closest("a").addClass("xheActive");var b=ja.offset();a=b.left;b=b.top;b+=ja.outerHeight()-1;pa.css({left:a+1,top:b,width:ja.width()}).show();if(a+N.outerWidth()>document.body.clientWidth)a-=N.outerWidth()-ja.outerWidth();var c=o.layerShadow;c>0&&oa.css({left:a+c,top:b+c,width:N.outerWidth(),height:N.outerHeight()}).show();N.css({left:a,top:b}).show();
$a=S=true};this.hidePanel=function(){if(S){ja.removeClass("xheActive");oa.hide();pa.hide();N.hide();S=false;if(!Da){e(".xheFixCancel").remove();Da=true}$a=wa=false;da=null}};this.exec=function(a){d.focus();d.hidePanel();d.saveBookmark();var b=qa[a];if(!b)return false;if(R===null){R={};var c=M.find(".xheButton[name="+a+"]");if(c.length===1)R.target=c}if(b.e)b.e.call(d);else{a=a.toLowerCase();switch(a){case "cut":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(h){alert("Currently not supported by your browser, use keyboard shortcuts(Ctrl+X) instead.")}break;
case "copy":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(p){alert("Currently not supported by your browser, use keyboard shortcuts(Ctrl+C) instead.")}break;case "paste":try{w.execCommand(a);if(!w.queryCommandSupported(a))throw"Error";}catch(m){alert("Currently not supported by your browser, use keyboard shortcuts(Ctrl+V) instead.")}break;case "pastetext":window.clipboardData?d.pasteText(window.clipboardData.getData("Text",true)):d.showPastetext();break;case "blocktag":var n=
[];e.each(vb,function(f,g){n.push({s:"<"+g.n+">"+g.t+"</"+g.n+">",v:"<"+g.n+">",t:g.t})});d.showMenu(n,function(f){d._exec("formatblock",f)});break;case "fontface":var i=[];e.each(wb,function(f,g){g.c=g.c?g.c:g.n;i.push({s:'<span style="font-family:'+g.c+'">'+g.n+"</span>",v:g.c,t:g.n})});d.showMenu(i,function(f){d._exec("fontname",f)});break;case "fontsize":var j=[];e.each(T,function(f,g){j.push({s:'<span style="font-size:'+g.s+';">'+g.t+"("+g.s+")</span>",v:f+1,t:g.t})});d.showMenu(j,function(f){d._exec("fontsize",
f)});break;case "fontcolor":d.showColor(function(f){d._exec("forecolor",f)});break;case "backcolor":d.showColor(function(f){if(y)d._exec("backcolor",f);else{Ta(true);d._exec("hilitecolor",f);Ta(false)}});break;case "align":d.showMenu(xb,function(f){d._exec(f)});break;case "list":d.showMenu(yb,function(f){d._exec(f)});break;case "link":d.showLink();break;case "img":d.showImg();break;case "flash":d.showEmbed("Flash",'<div>Flash URL:<input type="text" id="xheFlashUrl" value="http://" class="xheText" /></div><div>Dimension:<input type="text" id="xheFlashWidth" style="width:40px;" value="480" /> x <input type="text" id="xheFlashHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>',
"application/x-shockwave-flash","clsid:d27cdb6e-ae6d-11cf-96b8-4445535400000",' wmode="opaque" quality="high" menu="false" play="true" loop="true" allowfullscreen="true"',o.upFlashUrl,o.upFlashExt);break;case "media":d.showEmbed("Media",'<div>Media URL:<input type="text" id="xheMediaUrl" value="http://" class="xheText" /></div><div>Dimension:<input type="text" id="xheMediaWidth" style="width:40px;" value="480" /> x <input type="text" id="xheMediaHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="OK" /></div>',
"application/x-mplayer2","clsid:6bf52a52-394a-11d3-b153-00c04f79faa6",' enablecontextmenu="false" autostart="false"',o.upMediaUrl,o.upMediaExt);break;case "emot":d.showEmot();break;case "table":d.showTable();break;case "source":d.toggleSource();break;case "preview":d.showPreview();break;case "print":ca.print();break;case "fullscreen":d.toggleFullscreen();break;case "about":d.showAbout();break;default:d._exec(a)}}R=null};this._exec=function(a,b,c){c||d.focus();return b!==ha?w.execCommand(a,false,b):
w.execCommand(a,false,null)}};e(function(){e.fn.oldVal=e.fn.val;e.fn.val=function(B){var E=this,I;if(B===ha)return E[0]&&(I=E[0].xheditor)?I.getSource():E.oldVal();return E.each(function(){(I=this.xheditor)?I.setSource(B):E.oldVal(B)})};e("textarea").each(function(){var B=e(this),E=B.attr("class").match(/(?:^|\s)xheditor(?:\-(m?full|simple|mini))?(?:\s|$)/i);if(E)B.xheditor(E[1]?{tools:E[1]}:null)})})})(jQuery);

