(function(f){var c={};c.version="3.5.3 (2011-04-10)";c.scriptPath=function(){for(var a=document.getElementsByTagName("script"),b=0,d=a.length;b<d;b++)if(a[b].src&&a[b].src.match(/kindeditor[\w\-\.]*\.js/))return a[b].src.substring(0,a[b].src.lastIndexOf("/")+1);return""}();c.browser=function(){var a=navigator.userAgent.toLowerCase();return{VERSION:a.match(/(msie|firefox|webkit|opera)[\/:\s](\d+)/)?RegExp.$2:"0",IE:a.indexOf("msie")>-1&&a.indexOf("opera")==-1,GECKO:a.indexOf("gecko")>-1&&a.indexOf("khtml")==
-1,WEBKIT:a.indexOf("applewebkit")>-1,OPERA:a.indexOf("opera")>-1}}();c.setting={wyswygMode:true,loadStyleMode:true,resizeMode:2,filterMode:false,autoSetDataMode:false,shadowMode:true,useContextmenu:true,urlType:"",skinType:"default",syncType:"form",newlineTag:"p",dialogAlignType:"page",cssPath:"",skinsPath:c.scriptPath+"skins/",pluginsPath:c.scriptPath+"plugins/",minWidth:200,minHeight:100,minChangeSize:5,toolbarLineHeight:24,statusbarHeight:11,items:["source","|","fullscreen","undo","redo","print",
"cut","copy","paste","plainpaste","wordpaste","|","justifyleft","justifycenter","justifyright","justifyfull","insertorderedlist","insertunorderedlist","indent","outdent","subscript","superscript","|","selectall","-","title","fontname","fontsize","|","textcolor","bgcolor","bold","italic","underline","strikethrough","removeformat","|","image","flash","media","advtable","hr","emoticons","link","unlink","|","about"],colorTable:[["#E53333","#E56600","#FF9900","#64451D","#DFC5A4","#FFE500"],["#009900",
"#006600","#99BB00","#B8D100","#60D978","#00D5FF"],["#337FE5","#003399","#4C33E5","#9933E5","#CC33E5","#EE33EE"],["#FFFFFF","#CCCCCC","#999999","#666666","#333333","#000000"]],noEndTags:["br","hr","img","area","col","embed","input","param"],inlineTags:["b","del","em","font","i","span","strike","strong","sub","sup","u"],endlineTags:["br","hr","table","tbody","td","tr","th","div","p","ol","ul","li","blockquote","h1","h2","h3","h4","h5","h6","script","style","marquee"],htmlTags:{font:["color","size",
"face",".background-color"],span:[".color",".background-color",".font-size",".font-family",".background",".font-weight",".font-style",".text-decoration",".vertical-align"],div:["align",".border",".margin",".padding",".text-align",".color",".background-color",".font-size",".font-family",".font-weight",".background",".font-style",".text-decoration",".vertical-align",".margin-left"],table:["border","cellspacing","cellpadding","width","height","align","bordercolor",".padding",".margin",".border","bgcolor",
".text-align",".color",".background-color",".font-size",".font-family",".font-weight",".font-style",".text-decoration",".background",".width",".height"],"td,th":["align","valign","width","height","colspan","rowspan","bgcolor",".text-align",".color",".background-color",".font-size",".font-family",".font-weight",".font-style",".text-decoration",".vertical-align",".background"],a:["href","target","name"],embed:["src","width","height","type","loop","autostart","quality",".width",".height","align","allowscriptaccess",
"/"],img:["src","width","height","border","alt","title",".width",".height","/"],hr:["/"],br:["/"],"p,ol,ul,li,blockquote,h1,h2,h3,h4,h5,h6":["align",".text-align",".color",".background-color",".font-size",".font-family",".background",".font-weight",".font-style",".text-decoration",".vertical-align",".text-indent",".margin-left"],"tbody,tr,strong,b,sub,sup,em,i,u,strike":[]},mediaTypes:{rm:"audio/x-pn-realaudio-plugin",flash:"application/x-shockwave-flash",media:"video/x-ms-asf-plugin"},afterTab:function(a){c.util.setSelection(a);
c.util.insertHtml(a,"&nbsp;&nbsp;&nbsp;&nbsp;")}};c.g={};c.plugin={};c.$=function(a,b){return(b||document).getElementById(a)};c.$$=function(a,b){return(b||document).createElement(a)};c.event={add:function(a,b,d,e){if(a.addEventListener)a.addEventListener(b,d,false);else a.attachEvent&&a.attachEvent("on"+b,d);e!==f&&c.g[e].eventStack.push({el:a,type:b,fn:d})},remove:function(a,b,d,e){if(a.removeEventListener)a.removeEventListener(b,d,false);else a.detachEvent&&a.detachEvent("on"+b,d);if(e!==f){e=c.g[e].eventStack;
for(var g=0,h=e.length;g<h;g++){var i=e[g];i&&a===i.el&&b===i.type&&d===i.fn&&delete e[g]}}},stopPropagation:function(a){a.stopPropagation&&a.stopPropagation();if(a.cancelBubble!==f)a.cancelBubble=true},preventDefault:function(a){a.preventDefault&&a.preventDefault();if(a.returnValue!==f)a.returnValue=false},stop:function(a){this.stopPropagation(a);this.preventDefault(a)},bind:function(a,b,d,e){this.add(a,b,function(g){d(g);c.event.stop(g);return false},e)},input:function(a,b,d){function e(g){window.setTimeout(function(){b(g)},
1)}this.add(a,"keyup",function(g){if(!g.ctrlKey&&!g.altKey&&(g.keyCode<16||g.keyCode>18)&&g.keyCode!=116){b(g);c.event.stop(g);return false}},d);a=a.nodeName=="#document"?a.body:a;this.add(a,"paste",e,d);this.add(a,"cut",e,d)},ctrl:function(a,b,d,e){b=b.toString().match(/^\d{2,}$/)?b:b.toUpperCase().charCodeAt(0);this.add(a,"keydown",function(g){if(g.ctrlKey&&g.keyCode==b&&!g.shiftKey&&!g.altKey){d(g);c.event.stop(g);return false}},e)},ready:function(a,b,d,e){b=b||window;d=d||document;var g=false,
h=function(){if(!g){g=true;a()}};if(d.addEventListener)this.add(d,"DOMContentLoaded",h,e);else if(d.attachEvent){this.add(d,"readystatechange",function(){d.readyState=="complete"&&h()},e);if(d.documentElement.doScroll&&typeof b.frameElement==="undefined"){var i=function(){if(!g){try{d.documentElement.doScroll("left")}catch(j){window.setTimeout(i,0);return}h()}};i()}}this.add(b,"load",h,e)}};c.each=function(a,b){for(var d in a)a.hasOwnProperty(d)&&b(d,a[d])};c.eachNode=function(a,b){var d=function(e){if(c.util.getNodeType(e)!=
1)return true;for(e=e.firstChild;e;){var g=e.nextSibling;if(!b(e))return false;if(!d(e))return false;e=g}return true};d(a)};c.selection=function(a){this.keRange=this.range=this.sel=null;this.isControl=false;var b=a.parentWindow||a.defaultView;this.init=function(){var d=b.getSelection?b.getSelection():a.selection,e;try{e=d.rangeCount>0?d.getRangeAt(0):d.createRange()}catch(g){}e||(e=c.util.createRange(a));this.sel=d;this.range=e;var h,i,j;if(c.browser.IE)if(e.item){this.isControl=true;d=i=e.item(0);
h=j=0}else{this.isControl=false;d=function(l){var o=e.duplicate();o.collapse(l);var p=o.parentElement(),n=p.childNodes;if(n.length==0)return{node:p,pos:0};var r,q=0,t=false,m=e.duplicate();c.util.moveToElementText(m,p);for(var v=0,s=n.length;v<s;v++){l=n[v];var x=m.compareEndPoints("StartToStart",o);if(x>0)t=true;else if(x==0)if(l.nodeType==1){o=new c.range(a);o.selectTextNode(l);return{node:o.startNode,pos:0}}else return{node:l,pos:0};if(l.nodeType==1){x=e.duplicate();c.util.moveToElementText(x,
l);m.setEndPoint("StartToEnd",x);if(t)q+=x.text.replace(/\r\n|\n|\r/g,"").length;else q=0}else if(l.nodeType==3)if(typeof l.nodeValue==="string"){m.moveStart("character",l.nodeValue.length);q+=l.nodeValue.length}t||(r=l)}if(!t&&r.nodeType==1){r=p.lastChild;return{node:r,pos:r.nodeType==1?1:r.nodeValue.length}}m=e.duplicate();c.util.moveToElementText(m,p);m.setEndPoint("StartToEnd",o);q-=m.text.replace(/\r\n|\n|\r/g,"").length;return{node:r,pos:q}};h=d(true);j=d(false);d=h.node;h=h.pos;i=j.node;j=
j.pos}else{d=e.startContainer;h=e.startOffset;i=e.endContainer;j=e.endOffset;if(d.nodeType==1&&typeof d.childNodes[h]!="undefined"){d=d.childNodes[h];h=0}if(i.nodeType==1){j=j==0?1:j;if(typeof i.childNodes[j-1]!="undefined"){i=i.childNodes[j-1];j=i.nodeType==1?0:i.nodeValue.length}}this.isControl=d.nodeType==1&&d===i&&e.startOffset+1==e.endOffset;if(d.nodeType==1&&i.nodeType==3&&j==0&&i.previousSibling)for(var k=i.previousSibling;k;){if(k===d){i=d;break}if(k.childNodes.length!=1)break;k=k.childNodes[0]}if(e.collapsed){k=
new c.range(a);k.setTextStart(d,h);i=k.startNode;j=k.startPos}}k=new c.range(a);k.setTextStart(d,h);k.setTextEnd(i,j);this.keRange=k};this.init();this.addRange=function(d){if(!(c.browser.GECKO&&c.browser.VERSION<3)){this.keRange=d;if(c.browser.IE){var e=function(j){var k=c.util.createRange(a),l=j?d.startNode:d.endNode;if(l.nodeType==1){c.util.moveToElementText(k,l);k.collapse(j)}else if(l.nodeType==3){k=c.util.getNodeStartRange(a,l);k.moveStart("character",j?d.startPos:d.endPos)}return k};if(!this.range.item){var g=
d.startNode;if(g==d.endNode&&c.util.getNodeType(g)==1&&c.util.getNodeTextLength(g)==0){e=a.createTextNode(" ");g.appendChild(e);c.util.moveToElementText(this.range,g);this.range.collapse(false);this.range.select();g.removeChild(e)}else{if(g.nodeType==3&&d.collapsed()){this.range=e(true);this.range.collapse(true)}else{this.range.setEndPoint("StartToStart",e(true));this.range.setEndPoint("EndToStart",e(false))}this.range.select()}}}else{g=function(j){for(var k=0;j;){j=j.previousSibling;k++}return--k};
e=new c.range(a);e.setTextStart(d.startNode,d.startPos);e.setTextEnd(d.endNode,d.endPos);var h=e.startNode,i=e.endNode;c.util.getNodeType(h)==88?this.range.setStart(h.parentNode,g(e.startNode)):this.range.setStart(h,e.startPos);c.util.getNodeType(i)==88?this.range.setEnd(i.parentNode,g(e.endNode)+1):this.range.setEnd(i,e.endPos);this.sel.removeAllRanges();this.sel.addRange(this.range)}}};this.focus=function(){c.browser.IE&&this.range!=null&&this.range.select()}};c.range=function(a){this.endPos=this.endNode=
this.startPos=this.startNode=null;this.getParentElement=function(){var b=function(g,h){for(;g&&(!g.tagName||g.tagName.toLowerCase()!="body");){g=g.parentNode;if(h(g))return}},d=[];b(this.startNode,function(g){d.push(g)});var e;b(this.endNode,function(g){if(c.util.inArray(g,d)){e=g;return true}});return e?e:a.body};this.getNodeList=function(){var b=this,d=this.getParentElement(),e=[],g=false;if(d==b.startNode)g=true;g&&e.push(d);c.eachNode(d,function(h){if(h==b.startNode)g=true;var i=new c.range(a);
i.selectTextNode(h);var j=i.comparePoints("START_TO_END",b);if(j>0)return false;else if(j==0)if(i.startNode!==i.endNode||i.startPos!==i.endPos)return false;g&&e.push(h);return true});return e};this.comparePoints=function(b,d){var e=function(g,h,i,j){if(c.browser.IE){var k=function(o,p,n){var r=c.util.createRange(a),q=c.util.getNodeType(o);if(q==1){c.util.moveToElementText(r,o);r.collapse(n)}else if(q==3){r=c.util.getNodeStartRange(a,o);r.moveStart("character",p);r.collapse(true)}return r},l;l=b==
"START_TO_START"||b=="START_TO_END"?k(g,h,true):k(g,h,false);g=b=="START_TO_START"||b=="END_TO_START"?k(i,j,true):k(i,j,false);return l.compareEndPoints("StartToStart",g)}else{l=c.util.createRange(a);l.selectNode(g);b=="START_TO_START"||b=="START_TO_END"?l.collapse(true):l.collapse(false);g=c.util.createRange(a);g.selectNode(i);b=="START_TO_START"||b=="END_TO_START"?g.collapse(true):g.collapse(false);h=l.compareBoundaryPoints(Range.START_TO_START,g)>0?1:l.compareBoundaryPoints(Range.START_TO_START,
g)==0?h>j?1:h==j?0:-1:-1}return h};if(b=="START_TO_START")return e(this.startNode,this.startPos,d.startNode,d.startPos);if(b=="START_TO_END")return e(this.startNode,this.startPos,d.endNode,d.endPos);if(b=="END_TO_START")return e(this.endNode,this.endPos,d.startNode,d.startPos);if(b=="END_TO_END")return e(this.endNode,this.endPos,d.endNode,d.endPos)};this.collapsed=function(){return this.startNode===this.endNode&&this.startPos===this.endPos};this.collapse=function(b){b?this.setEnd(this.startNode,this.startPos):
this.setStart(this.endNode,this.endPos)};this.setTextStart=function(b,d){var e=b;c.eachNode(b,function(g){if(c.util.getNodeType(g)==3&&g.nodeValue.length>0||c.util.getNodeType(g)==88){e=g;d=0;return false}return true});this.setStart(e,d)};this.setStart=function(b,d){this.startNode=b;this.startPos=d;if(this.endNode===null){this.endNode=b;this.endPos=d}};this.setTextEnd=function(b,d){var e=b;c.eachNode(b,function(g){if(c.util.getNodeType(g)==3&&g.nodeValue.length>0||c.util.getNodeType(g)==88){e=g;d=
c.util.getNodeType(g)==3?g.nodeValue.length:0}return true});this.setEnd(e,d)};this.setEnd=function(b,d){this.endNode=b;this.endPos=d;if(this.startNode===null){this.startNode=b;this.startPos=d}};this.selectNode=function(b){this.setStart(b,0);this.setEnd(b,b.nodeType==1?0:b.nodeValue.length)};this.selectTextNode=function(b){this.setTextStart(b,0);this.setTextEnd(b,b.nodeType==1?0:b.nodeValue.length)};this.extractContents=function(b){b=b===f?true:b;var d=this,e=this.startNode,g=this.startPos,h=this.endNode,
i=this.endPos,j=function(q,t,m){var v=q.nodeValue.length,s=q.cloneNode(true).splitText(t);s.splitText(m-t);if(b){var x=q;if(t>0)x=q.splitText(t);m<v&&x.splitText(m-t);x.parentNode.removeChild(x)}return s},k=c.util.arrayToHash(c.setting.noEndTags),l=false,o=false,p=function(q,t){if(c.util.getNodeType(q)!=1)return true;for(var m=q.firstChild;m;){if(m==e)l=true;if(m==h)o=true;var v=m.nextSibling,s=m.nodeType;if(s==1){s=new c.range(a);s.selectNode(m);s=s.comparePoints("END_TO_END",d);if(l&&(s<0||s==0&&
k[m.nodeName.toLowerCase()]!==f)){s=m.cloneNode(true);t.appendChild(s);b&&m.parentNode.removeChild(m)}else{s=m.cloneNode(false);if(k[s.nodeName.toLowerCase()]===f){t.appendChild(s);if(!p(m,s))return false}}}else if(s==3)if(l)if(m==e&&m==h){m=j(m,g,i);t.appendChild(m);return false}else if(m==e){m=j(m,g,m.nodeValue.length);t.appendChild(m)}else if(m==h){m=j(m,0,i);t.appendChild(m);return false}else{m=j(m,0,m.nodeValue.length);t.appendChild(m)}m=v;if(o)return false}t.innerHTML.replace(/<.*?>/g,"")===
""&&t.parentNode&&t.parentNode.removeChild(t);return true},n=this.getParentElement(),r=n.cloneNode(false);p(n,r);return r};this.cloneContents=function(){return this.extractContents(false)};this.getText=function(){return this.cloneContents().innerHTML.replace(/<.*?>/g,"")}};c.cmd=function(a){this.doc=c.g[a].iframeDoc;this.keSel=c.g[a].keSel;this.keRange=c.g[a].keRange;this.mergeAttributes=function(b,d){for(var e=0,g=d.length;e<g;e++)c.each(d[e],function(h,i){if(h.charAt(0)=="."){var j=c.util.getJsKey(h.substr(1));
b.style[j]=i}else{if(c.browser.IE&&c.browser.VERSION<8&&h=="class")h="className";b.setAttribute(h,i)}});return b};this.wrapTextNode=function(b,d,e,g,h){var i=b.nodeValue.length,j=d==0&&e==i,k=new c.range(this.doc);k.selectTextNode(b.parentNode);if(j&&b.parentNode.tagName==g.tagName&&k.comparePoints("END_TO_END",this.keRange)<=0&&k.comparePoints("START_TO_START",this.keRange)>=0){this.mergeAttributes(b.parentNode,h);return b}else{g=g.cloneNode(true);if(j){d=b.cloneNode(true);g.appendChild(d);b.parentNode.replaceChild(g,
b);return d}else{j=b;if(d<e){if(d>0)j=b.splitText(d);e<i&&j.splitText(e-d);d=j.cloneNode(true);g.appendChild(d);j.parentNode.replaceChild(g,j);return d}else{if(d<i){j=b.splitText(d);j.parentNode.insertBefore(g,j)}else j.nextSibling?j.parentNode.insertBefore(g,j.nextSibling):j.parentNode.appendChild(g);return g}}}};this.wrap=function(b,d){d=d||[];var e=this;this.keSel.focus();var g=c.$$(b,this.doc);this.mergeAttributes(g,d);var h=this.keRange,i=h.startNode,j=h.startPos,k=h.endNode,l=h.endPos,o=h.getParentElement();
if(!c.util.inMarquee(o)){var p=false;c.eachNode(o,function(n){if(n==i)p=true;if(n.nodeType==1)if(n==i&&n==k){if(c.util.inArray(n.tagName.toLowerCase(),c.g[a].noEndTags))j>0?n.parentNode.appendChild(g):n.parentNode.insertBefore(g,n);else n.appendChild(g);h.selectNode(g);return false}else if(n==i)h.setStart(n,0);else{if(n==k){h.setEnd(n,0);return false}}else if(n.nodeType==3)if(p)if(n==i&&n==k){n=e.wrapTextNode(n,j,l,g,d);h.selectNode(n);return false}else if(n==i){n=e.wrapTextNode(n,j,n.nodeValue.length,
g,d);h.setStart(n,0)}else if(n==k){n=e.wrapTextNode(n,0,l,g,d);h.setEnd(n,n.nodeType==1?0:n.nodeValue.length);return false}else e.wrapTextNode(n,0,n.nodeValue.length,g,d);return true});this.keSel.addRange(h)}};this.getTopParent=function(b,d){for(var e=null;d;){d=d.parentNode;if(c.util.inArray(d.tagName.toLowerCase(),b))e=d;else break}return e};this.splitNodeParent=function(b,d,e){var g=new c.range(this.doc);g.selectNode(b.firstChild);g.setEnd(d,e);d=g.extractContents();b.parentNode.insertBefore(d,
b);return{left:d,right:b}};this.remove=function(b){var d=this.keRange,e=d.startNode,g=d.startPos,h=d.endNode,i=d.endPos;this.keSel.focus();if(!c.util.inMarquee(d.getParentElement())){var j=d.getText().replace(/\s+/g,"")==="";if(!(j&&!c.browser.IE)){var k=[];c.each(b,function(q){q!="*"&&k.push(q)});var l=this.getTopParent(k,e),o=this.getTopParent(k,h);if(l){var p=this.splitNodeParent(l,e,g);d.setStart(p.right,0);if(e==h&&c.util.getNodeTextLength(p.right)>0){d.selectNode(p.right);e=new c.range(this.doc);
e.selectTextNode(p.left);if(g>0)i-=e.endNode.nodeValue.length;e.selectTextNode(p.right);h=e.startNode}}if(j){l=d.startNode;if(l.nodeType==1){if(l.nodeName.toLowerCase()=="br")return;d.selectNode(l)}else return}else if(o){g=this.splitNodeParent(o,h,i);d.setEnd(g.left,0);l==o&&d.setStart(g.left,0)}o=function(q,t){if(t.charAt(0)=="."){var m=c.util.getJsKey(t.substr(1));q.style[m]=""}else{if(c.browser.IE&&c.browser.VERSION<8&&t=="class")t="className";q.removeAttribute(t)}};g=d.getNodeList();d.setTextStart(d.startNode,
d.startPos);d.setTextEnd(d.endNode,d.endPos);i=0;for(j=g.length;i<j;i++){l=g[i];if(l.nodeType==1){p=l.tagName.toLowerCase();if(b[p]){p=b[p];e=0;for(h=p.length;e<h;e++)if(p[e]=="*"){c.util.removeParent(l);break}else{o(l,p[e]);var n=[];if(l.outerHTML){attrHash=c.util.getAttrList(l.outerHTML);c.each(attrHash,function(q,t){n.push({name:q,value:t})})}else n=l.attributes;if(n.length==0){c.util.removeParent(l);break}else if(n[0].name=="style"&&n[0].value===""){c.util.removeParent(l);break}}}if(b["*"]){p=
b["*"];e=0;for(h=p.length;e<h;e++)o(l,p[e])}}}try{this.keSel.addRange(d)}catch(r){}}}}};c.format={getUrl:function(a,b,d,e){if(!b)return a;b=b.toLowerCase();if(!c.util.inArray(b,["absolute","relative","domain"]))return a;d=d||location.protocol+"//"+location.host;if(e===f){var g=location.pathname.match(/^(\/.*)\//);e=g?g[1]:""}if(g=a.match(/^(\w+:\/\/[^\/]*)/)){if(g[1]!==d)return a}else if(a.match(/^\w+:/))return a;g=function(i){i=i.split("/");paths=[];for(var j=0,k=i.length;j<k;j++){var l=i[j];if(l==
"..")paths.length>0&&paths.pop();else l!==""&&l!="."&&paths.push(l)}return"/"+paths.join("/")};if(a.match(/^\//))a=d+g(a.substr(1));else a.match(/^\w+:\/\//)||(a=d+g(e+"/"+a));if(b=="relative"){var h=function(i,j){if(a.substr(0,i.length)===i){for(var k=[],l=0;l<j;l++)k.push("..");l=".";if(k.length>0)l+="/"+k.join("/");if(e=="/")l+="/";return l+a.substr(i.length)}else if(k=i.match(/^(.*)\//))return h(k[1],++j)};a=h(d+e,0).substr(2)}else if(b=="absolute")if(a.substr(0,d.length)===d)a=a.substr(d.length);
return a},getHtml:function(a,b,d){var e=b?true:false;a=a.replace(/(<pre[^>]*>)([\s\S]*?)(<\/pre>)/ig,function(p,n,r,q){return n+r.replace(/<br[^>]*>/ig,"\n")+q});var g={},h=["xx-small","x-small","small","medium","large","x-large","xx-large"];e&&c.each(b,function(p,n){for(var r=p.split(","),q=0,t=r.length;q<t;q++)g[r[q]]=c.util.arrayToHash(n)});var i=false,j=c.util.arrayToHash(c.setting.noEndTags);c.util.arrayToHash(c.setting.inlineTags);var k=c.util.arrayToHash(c.setting.endlineTags);a=a.replace(/((?:\r\n|\n|\r)*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:]+="[^"]*")|(?:\s+[\w\-:]+='[^']*'))*)(\/)?>((?:\r\n|\n|\r)*)/g,
function(p,n,r,q,t,m,v){n=n||"";r=r||"";var s=q.toLowerCase();q=t||"";m=m?" "+m:"";v=v||"";if(s==="script"&&r!=="")i=false;if(i)return p;if(s==="script"&&r==="")i=true;if(e&&typeof g[s]=="undefined")return"";if(m===""&&typeof j[s]!="undefined")m=" /";if(s in k){if(r||m)v="\n"}else if(v)v=" ";if(s!=="script"&&s!=="style")n="";if(s==="font"){var x={},w="";q=q.replace(/\s*([\w\-:]+)=([^\s"'<>]+|"[^"]*"|'[^']*')/g,function(A,y,u){y=y.toLowerCase();u=u||"";u=u.replace(/^["']|["']$/g,"");if(y==="color"){x.color=
u;return" "}if(y==="size"){x["font-size"]=h[parseInt(u)-1]||"";return" "}if(y==="face"){x["font-family"]=u;return" "}if(y==="style"){w=u;return" "}return A});if(w&&!/;$/.test(w))w+=";";c.each(x,function(A,y){if(y!==""){if(/\s/.test(y))y="'"+y+"'";w+=A+":"+y+";"}});if(w)q+=' style="'+w+'"';s="span"}if(q!==""){q=q.replace(/\s*([\w\-:]+)=([^\s"'<>]+|"[^"]*"|'[^']*')/g,function(A,y,u){A=y.toLowerCase();u=u||"";if(e)if(A.charAt(0)==="."||A!=="style"&&typeof g[s][A]=="undefined")return" ";if(u==="")u='""';
else{if(A==="style"){u=u.substr(1,u.length-2);u=u.replace(/\s*([^\s]+?)\s*:(.*?)(;|$)/g,function(z,B,C){z=B.toLowerCase();if(e)if(typeof g[s].style=="undefined"&&typeof g[s]["."+z]=="undefined")return"";C=c.util.trim(C);C=c.util.rgbToHex(C);return z+":"+C+";"});u=c.util.trim(u);if(u==="")return"";u='"'+u+'"'}if(c.util.inArray(A,["src","href"])){if(u.charAt(0)==='"')u=u.substr(1,u.length-2);u=c.format.getUrl(u,d)}if(u.charAt(0)!=='"')u='"'+u+'"'}return" "+A+"="+u+" "});q=q.replace(/\s+(checked|selected|disabled|readonly)(\s+|$)/ig,
function(A,y){var u=y.toLowerCase();if(e)if(u.charAt(0)==="."||typeof g[s][u]=="undefined")return" ";return" "+u+'="'+u+'" '});q=c.util.trim(q);if(q=q.replace(/\s+/g," "))q=" "+q;return n+"<"+r+s+q+m+">"+v}else return n+"<"+r+s+m+">"+v});if(!c.browser.IE){a=a.replace(/<p><br\s+\/>\n<\/p>/ig,"<p>&nbsp;</p>");a=a.replace(/<br\s+\/>\n<\/p>/ig,"</p>")}var l=c.setting.inlineTags.join("|"),o=function(p){var n=p.replace(new RegExp("<("+l+")[^>]*><\\/("+l+")>","ig"),function(r,q,t){return q==t?"":r});if(p!==
n)n=o(n);return n};return c.util.trim(o(a))}};c.addClass=function(a,b){if(typeof a=="object"){var d=a.className;if(d){if((" "+d+" ").indexOf(" "+b+" ")<0)a.className=d+" "+b}else a.className=b}else if(typeof a=="string")a=/\s+class\s*=/.test(a)?a.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/,function(e,g,h,i){return(" "+h+" ").indexOf(" "+b+" ")<0?h===""?g+b+i:g+h+" "+b+i:e}):a.substr(0,a.length-1)+' class="'+b+'">';return a};c.removeClass=function(a,b){var d=a.className||"";d=" "+d+" ";b=" "+b+
" ";if(d.indexOf(b)>=0){d=c.util.trim(d.replace(new RegExp(b,"ig"),""));if(d===""){d=a.getAttribute("class")?"class":"className";a.removeAttribute(d)}else a.className=d}return a};c.getComputedStyle=function(a,b){var d=a.ownerDocument,e=d.parentWindow||d.defaultView;d=c.util.getJsKey(b);var g="";if(e.getComputedStyle){e=e.getComputedStyle(a,null);g=e[d]||e.getPropertyValue(b)||a.style[d]}else if(a.currentStyle)g=a.currentStyle[d]||a.style[d];return g};c.getCommonAncestor=function(a,b){function d(i){for(;i;){if(i.nodeType==
1)if(i.tagName.toLowerCase()===b)return i;i=i.parentNode}return null}var e=a.range,g=a.keRange,h=g.startNode;g=g.endNode;if(c.util.inArray(b,["table","td","tr"]))if(c.browser.IE)if(e.item){if(e.item(0).nodeName.toLowerCase()===b)h=g=e.item(0)}else{h=e.duplicate();h.collapse(true);e=e.duplicate();e.collapse(false);h=h.parentElement();g=e.parentElement()}else{h=e.cloneRange();h.collapse(true);e=e.cloneRange();e.collapse(false);h=h.startContainer;g=e.startContainer}e=d(h);h=d(g);if(e&&h&&e===h)return e;
return null};c.queryCommandValue=function(a,b){function d(){var i=a.queryCommandValue(b);if(typeof i!=="string")i="";return i}b=b.toLowerCase();var e="";if(b==="fontname"){e=d();e=e.replace(/['"]/g,"")}else if(b==="formatblock"){e=d();if(e===""){var g=new c.selection(a),h=c.getCommonAncestor(g,"h1");h||(h=c.getCommonAncestor(g,"h2"));h||(h=c.getCommonAncestor(g,"h3"));h||(h=c.getCommonAncestor(g,"h4"));h||(h=c.getCommonAncestor(g,"p"));if(h)e=h.nodeName}if(e==="Normal")e="p"}else if(b==="fontsize"){g=
new c.selection(a);if(h=c.getCommonAncestor(g,"span"))e=c.getComputedStyle(h,"font-size")}else if(b==="textcolor"){g=new c.selection(a);if(h=c.getCommonAncestor(g,"span"))e=c.getComputedStyle(h,"color");e=c.util.rgbToHex(e);if(e==="")e="default"}else if(b==="bgcolor"){g=new c.selection(a);if(h=c.getCommonAncestor(g,"span"))e=c.getComputedStyle(h,"background-color");e=c.util.rgbToHex(e);if(e==="")e="default"}return e.toLowerCase()};c.util={getDocumentElement:function(a){a=a||document;return a.compatMode!=
"CSS1Compat"?a.body:a.documentElement},getDocumentHeight:function(a){a=this.getDocumentElement(a);return Math.max(a.scrollHeight,a.clientHeight)},getDocumentWidth:function(a){a=this.getDocumentElement(a);return Math.max(a.scrollWidth,a.clientWidth)},createTable:function(a){a=c.$$("table",a);a.cellPadding=0;a.cellSpacing=0;a.border=0;return{table:a,cell:a.insertRow(0).insertCell(0)}},loadStyle:function(a){var b=c.$$("link");b.setAttribute("type","text/css");b.setAttribute("rel","stylesheet");b.setAttribute("href",
a);document.getElementsByTagName("head")[0].appendChild(b)},getAttrList:function(a){for(var b=/\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([\w\-:]+))|(?:([\w\-:]+)="([^"]*)")|(?:([\w\-:]+)='([^']*)'))(?=(?:\s|\/|>)+)/g,d,e,g={};d=b.exec(a);){e=d[1]||d[2]||d[4]||d[6];d=d[1]||(d[2]?d[3]:d[4]?d[5]:d[7]);g[e]=d}return g},inArray:function(a,b){for(var d=0;d<b.length;d++)if(a==b[d])return true;return false},trim:function(a){return a.replace(/^\s+|\s+$/g,"")},getJsKey:function(a){var b=a.split("-");a="";for(var d=0,
e=b.length;d<e;d++)a+=d>0?b[d].charAt(0).toUpperCase()+b[d].substr(1):b[d];return a},arrayToHash:function(a){for(var b={},d=0,e=a.length;d<e;d++)b[a[d]]=1;return b},escape:function(a){a=a.replace(/&/g,"&amp;");a=a.replace(/</g,"&lt;");a=a.replace(/>/g,"&gt;");return a=a.replace(/"/g,"&quot;")},unescape:function(a){a=a.replace(/&lt;/g,"<");a=a.replace(/&gt;/g,">");a=a.replace(/&quot;/g,'"');return a=a.replace(/&amp;/g,"&")},getScrollPos:function(){var a,b;if(c.browser.IE||c.browser.OPERA){b=this.getDocumentElement();
a=b.scrollLeft;b=b.scrollTop}else{a=window.scrollX;b=window.scrollY}return{x:a,y:b}},getElementPos:function(a){var b=0,d=0;if(a.getBoundingClientRect){d=a.getBoundingClientRect();a=this.getScrollPos();b=d.left+a.x;d=d.top+a.y}else{b=a.offsetLeft;d=a.offsetTop;for(a=a.offsetParent;a;){b+=a.offsetLeft;d+=a.offsetTop;a=a.offsetParent}}return{x:b,y:d}},getCoords:function(a){a=a||window.event;return{x:a.clientX,y:a.clientY}},setOpacity:function(a,b){if(typeof a.style.opacity=="undefined")a.style.filter=
b==100?"":"alpha(opacity="+b+")";else a.style.opacity=b==100?"":b/100},getIframeDoc:function(a){return a.contentDocument||a.contentWindow.document},rgbToHex:function(a){function b(d){d=parseInt(d).toString(16);return d.length>1?d:"0"+d}return a.replace(/rgb\s*?\(\s*?(\d+)\s*?,\s*?(\d+)\s*?,\s*?(\d+)\s*?\)/ig,function(d,e,g,h){return"#"+b(e)+b(g)+b(h)})},parseJson:function(a){var b;if(b=/\{[\s\S]*\}|\[[\s\S]*\]/.exec(a))a=b[0];b=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;
b.lastIndex=0;if(b.test(a))a=a.replace(b,function(d){return"\\u"+("0000"+d.charCodeAt(0).toString(16)).slice(-4)});if(/^[\],:{}\s]*$/.test(a.replace(/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,"@").replace(/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,"]").replace(/(?:^|:|,)(?:\s*\[)+/g,"")))return eval("("+a+")");throw"JSON parse error";},getParam:function(a,b){return a.match(new RegExp("[?&]"+b+"=([^?&]+)","i"))?unescape(RegExp.$1):""},createRange:function(a){return a.createRange?
a.createRange():a.body.createTextRange()},getNodeType:function(a){return a.nodeType==1&&c.util.inArray(a.tagName.toLowerCase(),c.setting.noEndTags)?88:a.nodeType},inMarquee:function(a){for(a=a;a;){if(a.nodeName.toLowerCase()==="marquee")return true;a=a.parentNode}return false},moveToElementText:function(a,b){this.inMarquee(b)||a.moveToElementText(b)},getNodeTextLength:function(a){var b=c.util.getNodeType(a);if(b==1)return a.innerHTML.replace(/<.*?>/ig,"").length;else if(b==3)return a.nodeValue.length},
getNodeStartRange:function(a,b){var d=c.util.createRange(a),e=b.nodeType;if(e==1){c.util.moveToElementText(d,b);return d}else if(e==3){e=0;for(var g=b.previousSibling;g;){if(g.nodeType==1){var h=c.util.createRange(a);c.util.moveToElementText(h,g);d.setEndPoint("StartToEnd",h);d.moveStart("character",e);return d}else if(g.nodeType==3)e+=g.nodeValue.length;g=g.previousSibling}c.util.moveToElementText(d,b.parentNode);d.moveStart("character",e);return d}},removeParent:function(a){if(a.hasChildNodes)for(var b=
a.firstChild;b;){var d=b.nextSibling;a.parentNode.insertBefore(b,a);b=d}a.parentNode.removeChild(a)},pluginLang:function(a,b){c.each(c.lang.plugins[a],function(d,e){var g=c.$("lang."+d,b);if(g){g.parentNode.insertBefore(b.createTextNode(e),g);g.parentNode.removeChild(g)}})},drag:function(a,b,d,e){var g=c.g[a];b.onmousedown=function(h){function i(y){if(x){var u=c.util.getCoords(y),z=c.util.getScrollPos();y=parseInt(u.y-t-v+z.y);u=parseInt(u.x-m-s+z.x);e(p,n,r,q,y,u)}}function j(y){if(x){var u=c.util.getCoords(y,
g.iframeDoc);y=parseInt(w.y+u.y-t-v);u=parseInt(w.x+u.x-m-s);e(p,n,r,q,y,u)}}function k(y){x=false;l.releaseCapture&&l.releaseCapture();c.event.remove(document,"mousemove",i);c.event.remove(document,"mouseup",k);c.event.remove(g.iframeDoc,"mousemove",j);c.event.remove(g.iframeDoc,"mouseup",k);c.event.remove(document,"selectstart",A);c.event.stop(y);return false}var l=this;h=h||window.event;var o=c.util.getCoords(h),p=parseInt(d.style.top),n=parseInt(d.style.left),r=d.style.width,q=d.style.height;
if(r.match(/%$/))r=d.offsetWidth+"px";if(q.match(/%$/))q=d.offsetHeight+"px";r=parseInt(r);q=parseInt(q);var t=o.y,m=o.x;o=c.util.getScrollPos();var v=o.y,s=o.x,x=true,w=c.util.getElementPos(g.iframe),A=function(){return false};c.event.add(document,"mousemove",i);c.event.add(document,"mouseup",k);c.event.add(g.iframeDoc,"mousemove",j);c.event.add(g.iframeDoc,"mouseup",k);c.event.add(document,"selectstart",A);l.setCapture&&l.setCapture();c.event.stop(h);return false}},resize:function(a,b,d,e,g){g=
typeof g=="undefined"?true:g;a=c.g[a];if(a.container)if(!(e&&(parseInt(b)<=a.minWidth||parseInt(d)<=a.minHeight))){if(g)a.container.style.width=b;a.container.style.height=d;b=parseInt(d)-a.toolbarHeight-a.statusbarHeight;if(b>=0){a.iframe.style.height=b+"px";a.newTextarea.style.height=((c.browser.IE&&c.browser.VERSION<8||document.compatMode!="CSS1Compat")&&b>=2?b-2:b)+"px"}}},hideLoadingPage:function(a){a=c.g[a].dialogStack;a=a[a.length-1];a.loading.style.display="none";a.iframe.style.display=""},
showLoadingPage:function(a){a=c.g[a].dialogStack;a=a[a.length-1];a.loading.style.display="";a.iframe.style.display="none"},setDefaultPlugin:function(){for(var a=["selectall","justifyleft","justifycenter","justifyright","justifyfull","insertorderedlist","insertunorderedlist","indent","outdent","subscript","superscript","bold","italic","underline","strikethrough"],b={bold:"B",italic:"I",underline:"U"},d=0;d<a.length;d++){var e=a[d],g={};if(e in b)g.init=function(h){return function(i){c.event.ctrl(c.g[i].iframeDoc,
b[h],function(){c.plugin[h].click(i);c.util.focus(i)},i)}}(e);g.click=function(h){return function(i){c.util.execCommand(i,h,null)}}(e);c.plugin[e]=g}},getFullHtml:function(a){var b="<html>";b+="<head>";b+='<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';b+="<title>KindEditor</title>";b+='<link href="'+c.g[a].skinsPath+"common/editor.css?ver="+escape(c.version)+'" rel="stylesheet" type="text/css" />';a=c.g[a].cssPath;if(typeof a=="string")a=[a];for(var d=0,e=a.length;d<e;d++)if(a[d]!==
"")b+='<link href="'+a[d]+'" rel="stylesheet" type="text/css" />';b+="</head>";b+='<body class="ke-content"></body>';b+="</html>";return b},getMediaType:function(a){return a.match(/\.(rm|rmvb)(\?|$)/i)?"rm":a.match(/\.(swf|flv)(\?|$)/i)?"flash":"media"},getMediaImage:function(a,b,d){var e=d.width,g=d.height;b=b||this.getMediaType(d.src);d=this.getMediaEmbed(d);var h="";if(e>0)h+="width:"+e+"px;";if(g>0)h+="height:"+g+"px;";a='<img class="'+("ke-"+b)+'" src="'+c.g[a].skinsPath+'common/blank.gif" ';
if(h!=="")a+='style="'+h+'" ';a+='kesrctag="'+escape(d)+'" alt="" />';return a},getMediaEmbed:function(a){var b="<embed ";c.each(a,function(d,e){b+=d+'="'+e+'" '});b+="/>";return b},execGetHtmlHooks:function(a,b){for(var d=c.g[a].getHtmlHooks,e=0,g=d.length;e<g;e++)b=d[e](b);return b},execSetHtmlHooks:function(a,b){for(var d=c.g[a].setHtmlHooks,e=0,g=d.length;e<g;e++)b=d[e](b);return b},execOnchangeHandler:function(a){a=c.g[a].onchangeHandlerStack;for(var b=0,d=a.length;b<d;b++)a[b]()},toData:function(a,
b){var d=c.g[a],e=this.execGetHtmlHooks(a,b);e=e.replace(/^\s*<br[^>]*>\s*$/ig,"");e=e.replace(/^\s*<p>\s*&nbsp;\s*<\/p>\s*$/ig,"");return d.filterMode?c.format.getHtml(e,d.htmlTags,d.urlType):c.format.getHtml(e,null,d.urlType)},getData:function(a,b){var d=c.g[a];(b=b===f?d.wyswygMode:b)||this.innerHtml(d.iframeDoc.body,c.util.execSetHtmlHooks(a,d.newTextarea.value));return this.toData(a,d.iframeDoc.body.innerHTML)},getSrcData:function(a){var b=c.g[a];b.wyswygMode||this.innerHtml(b.iframeDoc.body,
c.util.execSetHtmlHooks(a,b.newTextarea.value));return b.iframeDoc.body.innerHTML},getPureData:function(a){return this.extractText(this.getData(a))},extractText:function(a){a=a.replace(/<(?!img|embed).*?>/ig,"");return a=a.replace(/&nbsp;/ig," ")},isEmpty:function(a){return this.getPureData(a).replace(/\r\n|\n|\r/,"").replace(/^\s+|\s+$/,"")===""},setData:function(a){var b=c.g[a];if(b.srcTextarea)b.srcTextarea.value=this.getData(a)},focus:function(a){a=c.g[a];a.wyswygMode?a.iframeWin.focus():a.newTextarea.focus()},
click:function(a,b){this.focus(a);c.hideMenu(a);c.plugin[b].click(a)},selection:function(a){if(!c.browser.IE||!c.g[a].keRange)this.setSelection(a)},setSelection:function(a){a=c.g[a];var b=new c.selection(a.iframeDoc);if(!c.browser.IE||b.range.item||b.range.parentElement().ownerDocument===a.iframeDoc){a.keSel=b;a.keRange=a.keSel.keRange;a.sel=a.keSel.sel;a.range=a.keSel.range}},select:function(a){c.browser.IE&&c.g[a].wyswygMode&&c.g[a].range&&c.g[a].range.select()},execCommand:function(a,b,d){c.util.focus(a);
c.util.select(a);try{c.g[a].iframeDoc.execCommand(b,false,d)}catch(e){}c.toolbar.updateState(a);c.util.execOnchangeHandler(a)},innerHtml:function(a,b){if(c.browser.IE){a.innerHTML='<img id="__ke_temp_tag__" width="0" height="0" />'+b;var d=c.$("__ke_temp_tag__",a.ownerDocument);d&&d.parentNode.removeChild(d)}else a.innerHTML=b},pasteHtml:function(a,b,d){a=c.g[a];if(d)b='<img id="__ke_temp_tag__" width="0" height="0" />'+b;else b+='<img id="__ke_temp_tag__" width="0" height="0" />';if(c.browser.IE)if(a.range.item)a.range.item(0).outerHTML=
b;else a.range.pasteHTML(b);else{a.range.deleteContents();b=a.range.createContextualFragment(b);a.range.insertNode(b)}b=c.$("__ke_temp_tag__",a.iframeDoc);d=a.iframeDoc.createTextNode("");b.parentNode.replaceChild(d,b);a.keRange.selectNode(d);a.keSel.addRange(a.keRange)},insertHtml:function(a,b){if(b!==""){var d=c.g[a];if(d.wyswygMode)if(d.range){b=this.execSetHtmlHooks(a,b);if(c.browser.IE){this.select(a);if(d.range.item)try{d.range.item(0).outerHTML=b}catch(e){d=d.range.item(0);var g=d.parentNode;
g.removeChild(d);if(g.nodeName.toLowerCase()!="body")g=g.parentNode;this.innerHtml(g,b+g.innerHTML)}else d.range.pasteHTML(b)}else if(c.browser.GECKO&&c.browser.VERSION<3){this.execCommand(a,"inserthtml",b);return}else this.pasteHtml(a,b);c.util.execOnchangeHandler(a)}}},setFullHtml:function(a,b){var d=c.g[a];if(!c.browser.IE&&b==="")b="<br />";b=c.util.execSetHtmlHooks(a,b);this.innerHtml(d.iframeDoc.body,b);if(!d.wyswygMode)d.newTextarea.value=c.util.getData(a,true);c.util.execOnchangeHandler(a)},
selectImageWebkit:function(a,b,d){if(c.browser.WEBKIT){b=b.srcElement||b.target;if(b.tagName.toLowerCase()=="img"){d&&c.util.selection(a);d=c.g[a].keRange;d.selectNode(b);c.g[a].keSel.addRange(d)}}},addTabEvent:function(a){var b=c.g[a];c.event.add(b.iframeDoc,"keydown",function(d){if(d.keyCode==9){b.afterTab&&b.afterTab(a);c.event.stop(d);return false}},a)},addContextmenuEvent:function(a){var b=c.g[a];b.contextmenuItems.length!=0&&b.useContextmenu&&c.event.add(b.iframeDoc,"contextmenu",function(d){c.hideMenu(a);
c.util.setSelection(a);c.util.selectImageWebkit(a,d,false);for(var e=0,g=[],h=0,i=b.contextmenuItems.length;h<i;h++){var j=b.contextmenuItems[h];if(j==="-")g.push(j);else if(j.cond&&j.cond(a)){g.push(j);if(j.options){var k=parseInt(j.options.width)||0;if(k>e)e=k}}j=j}for(;g.length>0&&g[0]==="-";)g.shift();for(;g.length>0&&g[g.length-1]==="-";)g.pop();j=null;h=0;for(i=g.length;h<i;h++){g[h]==="-"&&j==="-"&&delete g[h];j=g[h]||null}if(g.length>0){var l=new c.menu({id:a,event:d,type:"contextmenu",width:e});
h=0;for(i=g.length;h<i;h++)if(j=g[h])if(j==="-")h<i-1&&l.addSeparator();else l.add(j.text,function(o){return function(){o.click(a,l)}}(j),j.options);l.show();c.event.stop(d);return false}return true},a)},addNewlineEvent:function(a){var b=c.g[a];c.browser.IE&&b.newlineTag.toLowerCase()!="br"||c.browser.GECKO&&c.browser.VERSION<3&&b.newlineTag.toLowerCase()!="p"||c.browser.OPERA||c.event.add(b.iframeDoc,"keydown",function(d){if(d.keyCode!=13||d.shiftKey||d.ctrlKey||d.altKey)return true;c.util.setSelection(a);
var e=b.keRange.getParentElement();if(!c.util.inMarquee(e)){e=e.tagName.toLowerCase();if(b.newlineTag.toLowerCase()=="br"){if(!c.util.inArray(e,["h1","h2","h3","h4","h5","h6","li"])){c.util.pasteHtml(a,"<br />");e=b.keRange.startNode.nextSibling;if(c.browser.IE)e||c.util.pasteHtml(a,"<br />",true);else if(c.browser.WEBKIT)if(e){var g=new c.range(b.iframeDoc);g.selectNode(e.parentNode);g.setStart(e,0);g.cloneContents().innerHTML.replace(/<(?!img|embed).*?>/ig,"")===""&&c.util.pasteHtml(a,"<br />",
true)}else c.util.pasteHtml(a,"<br />",true);c.event.stop(d);return false}}else c.util.inArray(e,["p","h1","h2","h3","h4","h5","h6","pre","div","li"])||c.util.execCommand(a,"formatblock","<P>");return true}},a)}};c.layout={hide:function(a){var b=c.g[a];c.hideMenu(a);for(a=b.dialogStack;a.length>0;)a[a.length-1].hide();b.maskDiv.style.display="none"}};c.hideMenu=function(a){a=c.g[a];a.hideDiv.innerHTML="";a.hideDiv.style.display="none"};c.colorpicker=function(a){var b,d=a.x||0,e=a.y||0,g=a.z||0,h=
a.colors||c.setting.colorTable,i=a.doc||document,j=a.onclick,k=(a.selectedColor||"").toLowerCase();b=c.$$("div");b.className="ke-colorpicker";b.style.top=e+"px";b.style.left=d+"px";b.style.zIndex=g;this.remove=function(){i.body.removeChild(b)};this.getElement=function(){function l(m,v,s){if(k===v.toLowerCase())s+=" ke-colorpicker-cell-selected";m.className=s;m.title=v||c.lang.noColor;m.onmouseover=function(){this.className=s+" ke-colorpicker-cell-on"};m.onmouseout=function(){this.className=s};m.onclick=
function(){j(v)};if(v){var x=c.$$("div");x.className="ke-colorpicker-cell-color";x.style.backgroundColor=v;m.appendChild(x)}else m.innerHTML=c.lang.noColor}var o=c.$$("table");o.className="ke-colorpicker-table";o.cellPadding=0;o.cellSpacing=0;o.border=0;var p=o.insertRow(0),n=p.insertCell(0);n.colSpan=h[0].length;l(n,"","ke-colorpicker-cell-top");for(var r=0;r<h.length;r++){p=o.insertRow(r+1);for(var q=0;q<h[r].length;q++){var t=h[r][q];n=p.insertCell(q);l(n,t,"ke-colorpicker-cell")}}return o};this.create=
function(){b.appendChild(this.getElement());c.event.bind(b,"click",function(){});c.event.bind(b,"mousedown",function(){});i.body.appendChild(b)}};c.menu=function(a){function b(d,e){var g=a.id,h=0,i=0;if(this.type=="menu"){g=c.g[g].toolbarIcon[a.cmd];i=c.util.getElementPos(g[0]);h=i.x;i=i.y+g[0].offsetHeight}else{i=c.util.getCoords(a.event);g=c.util.getElementPos(c.g[g].iframe);h=i.x+g.x;i=i.y+g.y+5}if(d>0||e>0){g=c.util.getScrollPos();var j=c.util.getDocumentElement();g=g.x+j.clientWidth-d-2;if(h>
g)h=g}return{x:h,y:i}}(function(){var d=a.width;this.type=a.type&&a.type=="contextmenu"?a.type:"menu";var e=c.$$("div");e.className="ke-"+this.type;e.setAttribute("name",a.cmd);var g=b.call(this,0,0);e.style.top=g.y+"px";e.style.left=g.x+"px";if(a.width)e.style.width=/^\d+$/.test(d)?d+"px":d;c.event.bind(e,"click",function(){},a.id);c.event.bind(e,"mousedown",function(){},a.id);this.div=e}).call(this);this.add=function(d,e,g){var h,i,j=false;if(g!==f){h=g.height;i=g.iconHtml;j=g.checked}var k=this;
g=c.$$("div");g.className="ke-"+k.type+"-item";if(h)g.style.height=h;var l=c.$$("div");l.className="ke-"+this.type+"-left";var o=c.$$("div");o.className="ke-"+k.type+"-center";if(h)o.style.height=h;var p=c.$$("div");p.className="ke-"+this.type+"-right";if(h)p.style.lineHeight=h;g.onmouseover=function(){this.className="ke-"+k.type+"-item ke-"+k.type+"-item-on";o.className="ke-"+k.type+"-center ke-"+k.type+"-center-on"};g.onmouseout=function(){this.className="ke-"+k.type+"-item";o.className="ke-"+k.type+
"-center"};g.onclick=e;g.appendChild(l);g.appendChild(o);g.appendChild(p);if(j)c.util.innerHtml(l,'<span class="ke-common-icon ke-common-icon-url ke-icon-checked"></span>');else i&&c.util.innerHtml(l,i);c.util.innerHtml(p,d);this.append(g)};this.addSeparator=function(){var d=c.$$("div");d.className="ke-"+this.type+"-separator";this.append(d)};this.append=function(d){this.div.appendChild(d)};this.insert=function(d){c.util.innerHtml(this.div,d)};this.hide=function(){c.hideMenu(a.id)};this.show=function(){this.hide();
var d=a.id;c.g[d].hideDiv.style.display="";c.g[d].hideDiv.appendChild(this.div);d=b.call(this,this.div.clientWidth,this.div.clientHeight);this.div.style.top=d.y+"px";this.div.style.left=d.x+"px"};this.picker=function(d){this.append((new c.colorpicker({colors:c.g[a.id].colorTable,onclick:function(e){c.plugin[a.cmd].exec(a.id,e)},selectedColor:d})).getElement());this.show()}};c.dialog=function(a){function b(){c.util.getDocumentElement();var h=c.util.getScrollPos();e=h.y;g=h.x}function d(){var h=this.width+
this.widthMargin,i=this.height+this.heightMargin,j=a.id,k=c.g[j],l=0,o=0;if(k.dialogAlignType=="page"){k=c.util.getDocumentElement();j=c.util.getScrollPos();l=Math.round(j.x+(k.clientWidth-h)/2);o=Math.round(j.y+(k.clientHeight-i)/2)}else{j=c.util.getElementPos(c.g[j].container);k=k.container;l=Math.round(k.clientWidth/2)-Math.round(h/2);i=Math.round(k.clientHeight/2)-Math.round(i/2);l=l<0?j.x:j.x+l;o=i<0?j.y:j.y+i}return{x:l<0?0:l,y:o<0?0:o}}this.widthMargin=30;this.heightMargin=100;this.zIndex=
19811214;this.width=a.width;this.height=a.height;var e,g;this.beforeHide=a.beforeHide;this.afterHide=a.afterHide;this.beforeShow=a.beforeShow;this.afterShow=a.afterShow;this.ondrag=a.ondrag;this.resize=function(h,i){if(h)this.width=h;if(i)this.height=i;this.hide();this.show()};this.hide=function(){this.beforeHide&&this.beforeHide(h);var h=a.id,i=c.g[h].dialogStack;if(i[i.length-1]==this){var j=i.pop().iframe;j.src="javascript:false";j.parentNode.removeChild(j);document.body.removeChild(this.div);
if(i.length<1)c.g[h].maskDiv.style.display="none";c.event.remove(window,"resize",b);c.event.remove(window,"scroll",b);this.afterHide&&this.afterHide(h);c.util.focus(h)}};this.show=function(){this.beforeShow&&this.beforeShow(i);var h=this,i=a.id,j=c.$$("div");j.className="ke-dialog";c.event.bind(j,"click",function(){},i);var k=c.g[i].dialogStack;if(k.length>0)this.zIndex=k[k.length-1].zIndex+1;j.style.zIndex=this.zIndex;k=d.call(this);j.style.top=k.y+"px";j.style.left=k.x+"px";var l;if(c.g[i].shadowMode){k=
c.$$("table");k.className="ke-dialog-table";k.cellPadding=0;k.cellSpacing=0;k.border=0;for(var o=["t","m","b"],p=["l","c","r"],n=0;n<3;n++)for(var r=k.insertRow(n),q=0;q<3;q++){var t=r.insertCell(q);t.className="ke-"+o[n]+p[q];if(n==1&&q==1)l=t;else t.innerHTML='<span class="ke-dialog-empty"></span>'}j.appendChild(k)}else{c.addClass(j,"ke-dialog-no-shadow");l=j}k=c.$$("div");k.className="ke-dialog-title";k.innerHTML=a.title;o=c.$$("span");o.className="ke-dialog-close";c.g[i].shadowMode?c.addClass(o,
"ke-dialog-close-shadow"):c.addClass(o,"ke-dialog-close-no-shadow");o.alt=c.lang.close;o.title=c.lang.close;o.onclick=function(){h.hide();c.util.select(i)};k.appendChild(o);b();c.event.add(window,"resize",b);c.event.add(window,"scroll",b);c.util.drag(i,k,j,function(m,v,s,x,w,A){h.ondrag&&h.ondrag(i);b();w=m+w;A=v+A;if(w<e)w=e;if(A<g)A=g;j.style.top=w+"px";j.style.left=A+"px"});l.appendChild(k);p=c.$$("div");p.className="ke-dialog-body";k=c.util.createTable();k.table.className="ke-loading-table";k.table.style.width=
this.width+"px";k.table.style.height=this.height+"px";o=c.$$("span");o.className="ke-loading-img";k.cell.appendChild(o);o=c.g[i].dialogStack.length==0&&c.g[i].dialog?c.g[i].dialog:c.$$("iframe");o.className=a.useFrameCSS?"ke-dialog-iframe ke-dialog-iframe-border":"ke-dialog-iframe";o.setAttribute("frameBorder","0");o.style.width=this.width+"px";o.style.height=this.height+"px";o.style.display="none";p.appendChild(o);p.appendChild(k.table);l.appendChild(p);q=c.$$("div");q.className="ke-dialog-bottom";
r=n=p=null;if(a.previewButton){r=c.$$("input");r.className="ke-button ke-dialog-preview";r.type="button";r.name="previewButton";r.value=a.previewButton;r.onclick=function(){var m=c.g[i].dialogStack;m[m.length-1]==h&&c.plugin[a.cmd].preview(i)};q.appendChild(r)}if(a.yesButton){n=c.$$("input");n.className="ke-button ke-dialog-yes";n.type="button";n.name="yesButton";n.value=a.yesButton;n.onclick=function(){var m=c.g[i].dialogStack;m[m.length-1]==h&&c.plugin[a.cmd].exec(i)};q.appendChild(n)}if(a.noButton){p=
c.$$("input");p.className="ke-button ke-dialog-no";p.type="button";p.name="noButton";p.value=a.noButton;p.onclick=function(){h.hide();c.util.select(i)};q.appendChild(p)}if(a.yesButton||a.noButton||a.previewButton)l.appendChild(q);document.body.appendChild(j);window.focus();if(n)n.focus();else p&&p.focus();if(a.html!==f){l=c.util.getIframeDoc(o);q=c.util.getFullHtml(i);l.open();l.write(q);l.close();c.util.innerHtml(l.body,a.html)}else if(a.url!==f)o.src=a.url;else{l="id="+escape(i)+"&ver="+escape(c.version);
if(a.file===f)o.src=c.g[i].pluginsPath+a.cmd+".html?"+l;else{l=(/\?/.test(a.file)?"&":"?")+l;o.src=c.g[i].pluginsPath+a.file+l}}c.g[i].maskDiv.style.width=c.util.getDocumentWidth()+"px";c.g[i].maskDiv.style.height=c.util.getDocumentHeight()+"px";c.g[i].maskDiv.style.display="block";this.iframe=o;this.loading=k.table;this.noButton=p;this.yesButton=n;this.previewButton=r;this.div=j;c.g[i].dialogStack.push(this);c.g[i].dialog=o;c.g[i].yesButton=n;c.g[i].noButton=p;c.g[i].previewButton=r;a.loadingMode||
c.util.hideLoadingPage(i);this.afterShow&&this.afterShow(i);c.g[i].afterDialogCreate&&c.g[i].afterDialogCreate(i)}};c.toolbar={updateState:function(a){for(var b=["justifyleft","justifycenter","justifyright","justifyfull","insertorderedlist","insertunorderedlist","indent","outdent","subscript","superscript","bold","italic","underline","strikethrough"],d=0;d<b.length;d++){var e=b[d],g=false;try{g=c.g[a].iframeDoc.queryCommandState(e)}catch(h){}g?c.toolbar.select(a,e):c.toolbar.unselect(a,e)}},isSelected:function(a,
b){return c.plugin[b]&&c.plugin[b].isSelected?true:false},select:function(a,b){if(c.g[a].toolbarIcon[b]){var d=c.g[a].toolbarIcon[b][0];d.className="ke-icon ke-icon-selected";d.onmouseover=null;d.onmouseout=null}},unselect:function(a,b){if(c.g[a].toolbarIcon[b]){var d=c.g[a].toolbarIcon[b][0];d.className="ke-icon";d.onmouseover=function(){this.className="ke-icon ke-icon-on"};d.onmouseout=function(){this.className="ke-icon"}}},_setAttr:function(a,b,d){b.className="ke-icon";b.href="javascript:;";b.onclick=
function(e){e=e||window.event;var g=c.g[a].hideDiv.firstChild;g&&g.getAttribute("name")==d?c.hideMenu(a):c.util.click(a,d);e.preventDefault&&e.preventDefault();e.stopPropagation&&e.stopPropagation();if(e.cancelBubble!==f)e.cancelBubble=true;return false};b.onmouseover=function(){this.className="ke-icon ke-icon-on"};b.onmouseout=function(){this.className="ke-icon"};b.hidefocus=true;b.title=c.lang[d]},able:function(a,b){var d=this;c.each(c.g[a].toolbarIcon,function(e,g){if(!c.util.inArray(e,b)){var h=
g[1];d._setAttr(a,g[0],e);c.util.setOpacity(h,100)}})},disable:function(a,b){c.each(c.g[a].toolbarIcon,function(d,e){if(!c.util.inArray(d,b)){var g=e[0],h=e[1];g.className="ke-icon ke-icon-disabled";c.util.setOpacity(h,50);g.onclick=null;g.onmouseover=null;g.onmouseout=null}})},create:function(a){var b=c.util.arrayToHash(c.setting.items);c.g[a].toolbarIcon=[];var d=c.util.createTable(),e=d.table;e.className="ke-toolbar";e.oncontextmenu=function(){return false};e.onmousedown=function(){return false};
e.onmousemove=function(){return false};d=d.cell;var g=c.g[a].items.length,h=0,i;c.g[a].toolbarHeight=c.g[a].toolbarLineHeight;for(var j=0;j<g;j++){var k=c.g[a].items[j];if(j==0||k=="-"){var l=c.util.createTable().table;l.className="ke-toolbar-table";i=l.insertRow(0);h=0;d.appendChild(l);if(k=="-"){c.g[a].toolbarHeight+=c.g[a].toolbarLineHeight;continue}}l=i.insertCell(h);l.hideforcus=true;h++;if(k=="|"){k=c.$$("div");k.className="ke-toolbar-separator";l.appendChild(k)}else{var o=c.$$("a");o.tabIndex=
-1;this._setAttr(a,o,k);var p=c.$$("span");p.className=typeof b[k]=="undefined"?"ke-common-icon ke-icon-"+k:"ke-common-icon ke-common-icon-url ke-icon-"+k;o.appendChild(p);l.appendChild(o);c.g[a].toolbarIcon[k]=[o,p];c.toolbar.isSelected(a,k)&&c.toolbar.select(a,k)}}return e}};c.history={addStackData:function(a,b){var d="";if(a.length>0)d=a[a.length-1];if(a.length==0||b!==d)a.push(b)},add:function(a,b){var d=c.g[a],e=c.util.getSrcData(a);if(d.undoStack.length>0)if(Math.abs(e.length-d.undoStack[d.undoStack.length-
1].length)<b)return;this.addStackData(d.undoStack,e)},undo:function(a){var b=c.g[a];if(b.undoStack.length!=0){var d=c.util.getSrcData(a);this.addStackData(b.redoStack,d);var e=b.undoStack.pop();if(d===e&&b.undoStack.length>0)e=b.undoStack.pop();e=c.util.toData(a,e);if(b.wyswygMode)c.util.innerHtml(b.iframeDoc.body,c.util.execSetHtmlHooks(a,e));else b.newTextarea.value=e}},redo:function(a){var b=c.g[a];if(b.redoStack.length!=0){var d=c.util.getSrcData(a);this.addStackData(b.undoStack,d);d=b.redoStack.pop();
d=c.util.toData(a,d);if(b.wyswygMode)c.util.innerHtml(b.iframeDoc.body,c.util.execSetHtmlHooks(a,d));else b.newTextarea.value=d}}};c.readonly=function(a,b){b=b==f?true:b;var d=c.g[a];if(c.browser.IE)d.iframeDoc.body.contentEditable=b?"false":"true";else d.iframeDoc.designMode=b?"off":"on"};c.focus=function(a,b){b=(b||"").toLowerCase();if(c.g[a].container){c.util.focus(a);if(b==="end"){c.util.setSelection(a);if(c.g[a].sel){var d=c.g[a].keSel,e=c.g[a].keRange;e.selectTextNode(c.g[a].iframeDoc.body);
e.collapse(false);d.addRange(e)}}}};c.blur=function(a){a=c.g[a];if(a.container)if(c.browser.IE){var b=c.$$("input");b.type="text";a.container.appendChild(b);b.focus();a.container.removeChild(b)}else a.wyswygMode?a.iframeWin.blur():a.newTextarea.blur()};c.html=function(a,b){if(b===f)return c.util.getData(a);else if(c.g[a].container){c.util.setFullHtml(a,b);c.focus(a)}};c.text=function(a,b){if(b===f){b=c.html(a);b=b.replace(/<.*?>/ig,"");b=b.replace(/&nbsp;/ig," ");return b=c.util.trim(b)}else c.html(a,
c.util.escape(b))};c.insertHtml=function(a,b){if(c.g[a].container)if(c.g[a].range){c.focus(a);c.util.selection(a);c.util.insertHtml(a,b)}else c.appendHtml(a,b)};c.appendHtml=function(a,b){c.html(a,c.html(a)+b)};c.isEmpty=function(a){return c.util.isEmpty(a)};c.selectedHtml=function(a){var b=c.g[a].range;if(!b)return"";var d="";if(c.browser.IE)d=b.item?b.item(0).outerHTML:b.htmlText;else{d=c.$$("div",c.g[a].iframeDoc);d.appendChild(b.cloneContents());d=d.innerHTML}return c.util.toData(a,d)};c.count=
function(a,b){b=(b||"html").toLowerCase();if(b==="html")return c.html(a).length;else if(b==="text"){var d=c.util.getPureData(a);d=d.replace(/<(?:img|embed).*?>/ig,"K");d=d.replace(/\r\n|\n|\r/g,"");d=c.util.trim(d);return d.length}return 0};c.sync=function(a){return c.util.setData(a)};c.remove=function(a,b){var d=c.g[a];if(!d.container)return false;b=typeof b=="undefined"?0:b;c.util.setData(a);for(var e=d.container,g=d.eventStack,h=0,i=g.length;h<i;h++){var j=g[h];j&&c.event.remove(j.el,j.type,j.fn,
a)}d.iframeDoc.src="javascript:false";d.iframe.parentNode.removeChild(d.iframe);if(b==1)document.body.removeChild(e);else{g=d.srcTextarea;g.parentNode.removeChild(e);if(b==0)g.style.display=""}document.body.removeChild(d.hideDiv);document.body.removeChild(d.maskDiv);d.container=null;d.dialogStack=[];d.contextmenuItems=[];d.getHtmlHooks=[];d.setHtmlHooks=[];d.onchangeHandlerStack=[];d.eventStack=[]};c.create=function(a,b){function d(){c.hideMenu(a)}function e(){c.toolbar.updateState(a)}function g(){c.g[a].afterFocus&&
c.g[a].afterFocus(a)}function h(){c.g[a].afterBlur&&c.g[a].afterBlur(a)}function i(){c.util.setSelection(a)}c.g[a].beforeCreate&&c.g[a].beforeCreate(a);if(c.browser.IE&&c.browser.VERSION<7)try{document.execCommand("BackgroundImageCache",false,true)}catch(j){}var k=c.$(a)||document.getElementsByName(a)[0];b=typeof b=="undefined"?0:b;if(!(b==0&&c.g[a].container)){var l=c.g[a].width||k.style.width||k.offsetWidth+"px",o=c.g[a].height||k.style.height||k.offsetHeight+"px",p=c.util.createTable(),n=p.table;
n.className="ke-container";n.style.width=l;n.style.height=o;var r=p.cell;r.className="ke-toolbar-outer";var q=n.insertRow(1).insertCell(0);q.className="ke-textarea-outer";p=c.util.createTable();var t=p.table;t.className="ke-textarea-table";var m=p.cell;q.appendChild(t);var v=n.insertRow(2).insertCell(0);v.className="ke-bottom-outer";k.style.display="none";b==1?document.body.appendChild(n):k.parentNode.insertBefore(n,k);q=c.toolbar.create(a);q.style.height=c.g[a].toolbarHeight+"px";r.appendChild(q);
p=c.g[a].iframe||c.$$("iframe");p.tabIndex=c.g[a].tabIndex||k.tabIndex;p.className="ke-iframe";p.setAttribute("frameBorder","0");r=c.$$("textarea");r.tabIndex=p.tabIndex;r.className="ke-textarea";r.style.display="none";c.g[a].container=n;c.g[a].iframe=p;c.g[a].newTextarea=r;c.util.resize(a,l,o);m.appendChild(p);m.appendChild(r);m=c.$$("table");m.className="ke-bottom";m.cellPadding=0;m.cellSpacing=0;m.border=0;m.style.height=c.g[a].statusbarHeight+"px";var s=m.insertRow(0),x=s.insertCell(0);x.className=
"ke-bottom-left";var w=c.$$("span");w.className="ke-bottom-left-img";if(c.g[a].config.resizeMode==0||b==1){x.style.cursor="default";w.style.visibility="hidden"}x.appendChild(w);s=s.insertCell(1);s.className="ke-bottom-right";w=c.$$("span");w.className="ke-bottom-right-img";if(c.g[a].config.resizeMode==0||b==1){s.style.cursor="default";w.style.visibility="hidden"}else if(c.g[a].config.resizeMode==1){s.style.cursor="s-resize";w.style.visibility="hidden"}s.appendChild(w);v.appendChild(m);v=c.$$("div");
v.className="ke-reset";v.style.display="none";w=c.$$("div");w.className="ke-mask";c.util.setOpacity(w,50);c.event.bind(w,"click",function(){},a);c.event.bind(w,"mousedown",function(){},a);document.body.appendChild(v);document.body.appendChild(w);c.util.setDefaultPlugin(a);var A=p.contentWindow,y=c.util.getIframeDoc(p);if(!c.browser.IE)y.designMode="on";var u=c.util.getFullHtml(a);y.open();y.write(u);y.close();if(!c.g[a].wyswygMode){r.value=c.util.execSetHtmlHooks(a,k.value);r.style.display="block";
p.style.display="none";c.toolbar.disable(a,["source","fullscreen"]);c.toolbar.select(a,"source")}if(c.g[a].syncType=="form")for(p=k;p=p.parentNode;)if(p.nodeName.toLowerCase()=="form"){c.event.add(p,"submit",function(){c.sync(a)},a);break}c.browser.WEBKIT&&c.event.add(y,"click",function(z){c.util.selectImageWebkit(a,z,true)},a);c.browser.IE&&c.event.add(y,"keydown",function(z){if(z.keyCode==8){z=c.g[a].range;if(z.item){z=z.item(0);z.parentNode.removeChild(z);c.util.execOnchangeHandler(a);c.event.stop(a);
return false}}},a);c.event.add(y,"mousedown",d,a);c.event.add(y,"click",e,a);c.event.input(y,e,a);c.event.bind(r,"click",d,a);c.event.add(document,"click",d,a);c.event.add(A,"focus",g);c.event.add(r,"focus",g);c.event.add(A,"blur",h);c.event.add(r,"blur",h);c.g[a].toolbarTable=q;c.g[a].textareaTable=t;c.g[a].srcTextarea=k;c.g[a].bottom=m;c.g[a].hideDiv=v;c.g[a].maskDiv=w;c.g[a].iframeWin=A;c.g[a].iframeDoc=y;c.g[a].width=l;c.g[a].height=o;c.util.drag(a,s,n,function(z,B,C,D,E,F){if(c.g[a].resizeMode==
2)c.util.resize(a,C+F+"px",D+E+"px",true);else c.g[a].resizeMode==1&&c.util.resize(a,C+"px",D+E+"px",true,false)});c.util.drag(a,x,n,function(z,B,C,D,E){c.g[a].resizeMode>0&&c.util.resize(a,C+"px",D+E+"px",true,false)});c.each(c.plugin,function(z,B){B.init&&B.init(a)});c.g[a].getHtmlHooks.push(function(z){return z.replace(/(<[^>]*)kesrc="([^"]+)"([^>]*>)/ig,function(B,C,D){B=B.replace(/(\s+(?:href|src)=")[^"]+(")/i,"$1"+D+"$2");return B=B.replace(/\s+kesrc="[^"]+"/i,"")})});c.g[a].setHtmlHooks.push(function(z){return z.replace(/(<[^>]*)(href|src)="([^"]+)"([^>]*>)/ig,
function(B,C,D,E,F){if(B.match(/\skesrc="[^"]+"/i))return B;return C+D+'="'+E+'" kesrc="'+E+'"'+F})});c.util.addContextmenuEvent(a);c.util.addNewlineEvent(a);c.util.addTabEvent(a);c.event.input(y,i,a);c.event.add(y,"mouseup",i,a);c.event.add(document,"mousedown",i,a);c.onchange(a,function(z){if(c.g[z].autoSetDataMode||c.g[z].syncType=="auto"){c.util.setData(z);c.g[z].afterSetData&&c.g[z].afterSetData(z)}c.g[z].afterChange&&c.g[z].afterChange(z);c.history.add(z,c.g[z].minChangeSize)});c.browser.IE&&
c.readonly(a,false);c.browser.IE&&c.browser.VERSION<8&&c.blur(a);c.util.setFullHtml(a,k.value);c.history.add(a,0);b>0&&c.util.focus(a);c.g[a].afterCreate&&c.g[a].afterCreate(a)}};c.onchange=function(a,b){function d(){b(a)}var e=c.g[a];e.onchangeHandlerStack.push(d);c.event.input(e.iframeDoc,d,a);c.event.input(e.newTextarea,d,a);c.event.add(e.iframeDoc,"mouseup",function(){window.setTimeout(function(){b(a)},0)},a)};c.init=function(a){var b=c.g[a.id]=a;b.config={};b.undoStack=[];b.redoStack=[];b.dialogStack=
[];b.contextmenuItems=[];b.getHtmlHooks=[];b.setHtmlHooks=[];b.onchangeHandlerStack=[];b.eventStack=[];c.each(c.setting,function(d,e){b[d]=typeof a[d]=="undefined"?e:a[d];b.config[d]=b[d]});b.loadStyleMode&&c.util.loadStyle(b.skinsPath+b.skinType+".css")};c.show=function(a){c.init(a);c.event.ready(function(){c.create(a.id)})};if(window.KE===f)window.KE=c;window.KindEditor=c})();
(function(f){f.langType="zh_CN";f.lang={source:"HTML\u4ee3\u7801",undo:"\u540e\u9000(Ctrl+Z)",redo:"\u524d\u8fdb(Ctrl+Y)",cut:"\u526a\u5207(Ctrl+X)",copy:"\u590d\u5236(Ctrl+C)",paste:"\u7c98\u8d34(Ctrl+V)",plainpaste:"\u7c98\u8d34\u4e3a\u65e0\u683c\u5f0f\u6587\u672c",wordpaste:"\u4eceWord\u7c98\u8d34",selectall:"\u5168\u9009",justifyleft:"\u5de6\u5bf9\u9f50",justifycenter:"\u5c45\u4e2d",justifyright:"\u53f3\u5bf9\u9f50",justifyfull:"\u4e24\u7aef\u5bf9\u9f50",insertorderedlist:"\u7f16\u53f7",insertunorderedlist:"\u9879\u76ee\u7b26\u53f7",
indent:"\u589e\u52a0\u7f29\u8fdb",outdent:"\u51cf\u5c11\u7f29\u8fdb",subscript:"\u4e0b\u6807",superscript:"\u4e0a\u6807",title:"\u6807\u9898",fontname:"\u5b57\u4f53",fontsize:"\u6587\u5b57\u5927\u5c0f",textcolor:"\u6587\u5b57\u989c\u8272",bgcolor:"\u6587\u5b57\u80cc\u666f",bold:"\u7c97\u4f53(Ctrl+B)",italic:"\u659c\u4f53(Ctrl+I)",underline:"\u4e0b\u5212\u7ebf(Ctrl+U)",strikethrough:"\u5220\u9664\u7ebf",removeformat:"\u5220\u9664\u683c\u5f0f",image:"\u56fe\u7247",flash:"\u63d2\u5165Flash",media:"\u63d2\u5165\u591a\u5a92\u4f53",
table:"\u63d2\u5165\u8868\u683c",hr:"\u63d2\u5165\u6a2a\u7ebf",emoticons:"\u63d2\u5165\u8868\u60c5",link:"\u8d85\u7ea7\u94fe\u63a5",unlink:"\u53d6\u6d88\u8d85\u7ea7\u94fe\u63a5",fullscreen:"\u5168\u5c4f\u663e\u793a",about:"\u5173\u4e8e",print:"\u6253\u5370",fileManager:"\u6d4f\u89c8\u670d\u52a1\u5668",advtable:"\u8868\u683c",yes:"\u786e\u5b9a",no:"\u53d6\u6d88",close:"\u5173\u95ed",editImage:"\u56fe\u7247\u5c5e\u6027",deleteImage:"\u5220\u9664\u56fe\u7247",editLink:"\u8d85\u7ea7\u94fe\u63a5\u5c5e\u6027",
deleteLink:"\u53d6\u6d88\u8d85\u7ea7\u94fe\u63a5",tableprop:"\u8868\u683c\u5c5e\u6027",tableinsert:"\u63d2\u5165\u8868\u683c",tabledelete:"\u5220\u9664\u8868\u683c",tablecolinsertleft:"\u5de6\u4fa7\u63d2\u5165\u5217",tablecolinsertright:"\u53f3\u4fa7\u63d2\u5165\u5217",tablerowinsertabove:"\u4e0a\u65b9\u63d2\u5165\u884c",tablerowinsertbelow:"\u4e0b\u65b9\u63d2\u5165\u884c",tablecoldelete:"\u5220\u9664\u5217",tablerowdelete:"\u5220\u9664\u884c",noColor:"\u65e0\u989c\u8272",invalidImg:"\u8bf7\u8f93\u5165\u6709\u6548\u7684URL\u5730\u5740\u3002\n\u53ea\u5141\u8bb8jpg,gif,bmp,png\u683c\u5f0f\u3002",
invalidMedia:"\u8bf7\u8f93\u5165\u6709\u6548\u7684URL\u5730\u5740\u3002\n\u53ea\u5141\u8bb8swf,flv,mp3,wav,wma,wmv,mid,avi,mpg,asf,rm,rmvb\u683c\u5f0f\u3002",invalidWidth:"\u5bbd\u5ea6\u5fc5\u987b\u4e3a\u6570\u5b57\u3002",invalidHeight:"\u9ad8\u5ea6\u5fc5\u987b\u4e3a\u6570\u5b57\u3002",invalidBorder:"\u8fb9\u6846\u5fc5\u987b\u4e3a\u6570\u5b57\u3002",invalidUrl:"\u8bf7\u8f93\u5165\u6709\u6548\u7684URL\u5730\u5740\u3002",invalidRows:"\u884c\u6570\u4e3a\u5fc5\u9009\u9879\uff0c\u53ea\u5141\u8bb8\u8f93\u5165\u5927\u4e8e0\u7684\u6570\u5b57\u3002",
invalidCols:"\u5217\u6570\u4e3a\u5fc5\u9009\u9879\uff0c\u53ea\u5141\u8bb8\u8f93\u5165\u5927\u4e8e0\u7684\u6570\u5b57\u3002",invalidPadding:"\u8fb9\u8ddd\u5fc5\u987b\u4e3a\u6570\u5b57\u3002",invalidSpacing:"\u95f4\u8ddd\u5fc5\u987b\u4e3a\u6570\u5b57\u3002",invalidBorder:"\u8fb9\u6846\u5fc5\u987b\u4e3a\u6570\u5b57\u3002",pleaseInput:"\u8bf7\u8f93\u5165\u5185\u5bb9\u3002",invalidJson:"\u670d\u52a1\u5668\u53d1\u751f\u6545\u969c\u3002",cutError:"\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u526a\u5207\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u5feb\u6377\u952e(Ctrl+X)\u6765\u5b8c\u6210\u3002",
copyError:"\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u590d\u5236\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u5feb\u6377\u952e(Ctrl+C)\u6765\u5b8c\u6210\u3002",pasteError:"\u60a8\u7684\u6d4f\u89c8\u5668\u5b89\u5168\u8bbe\u7f6e\u4e0d\u5141\u8bb8\u4f7f\u7528\u7c98\u8d34\u64cd\u4f5c\uff0c\u8bf7\u4f7f\u7528\u5feb\u6377\u952e(Ctrl+V)\u6765\u5b8c\u6210\u3002"};var c=f.lang.plugins={};c.about={version:f.version,title:"HTML\u53ef\u89c6\u5316\u7f16\u8f91\u5668"};c.plainpaste=
{comment:"\u8bf7\u4f7f\u7528\u5feb\u6377\u952e(Ctrl+V)\u628a\u5185\u5bb9\u7c98\u8d34\u5230\u4e0b\u9762\u7684\u65b9\u6846\u91cc\u3002"};c.wordpaste={comment:"\u8bf7\u4f7f\u7528\u5feb\u6377\u952e(Ctrl+V)\u628a\u5185\u5bb9\u7c98\u8d34\u5230\u4e0b\u9762\u7684\u65b9\u6846\u91cc\u3002"};c.link={url:"URL\u5730\u5740",linkType:"\u6253\u5f00\u7c7b\u578b",newWindow:"\u65b0\u7a97\u53e3",selfWindow:"\u5f53\u524d\u7a97\u53e3"};c.flash={url:"Flash\u5730\u5740",width:"\u5bbd\u5ea6",height:"\u9ad8\u5ea6"};c.media=
{url:"\u5a92\u4f53\u6587\u4ef6\u5730\u5740",width:"\u5bbd\u5ea6",height:"\u9ad8\u5ea6",autostart:"\u81ea\u52a8\u64ad\u653e"};c.image={remoteImage:"\u8fdc\u7a0b\u56fe\u7247",localImage:"\u672c\u5730\u4e0a\u4f20",remoteUrl:"\u56fe\u7247\u5730\u5740",localUrl:"\u56fe\u7247\u5730\u5740",size:"\u56fe\u7247\u5927\u5c0f",width:"\u5bbd",height:"\u9ad8",resetSize:"\u91cd\u7f6e\u5927\u5c0f",align:"\u5bf9\u9f50\u65b9\u5f0f",defaultAlign:"\u9ed8\u8ba4\u65b9\u5f0f",leftAlign:"\u5de6\u5bf9\u9f50",rightAlign:"\u53f3\u5bf9\u9f50",
imgTitle:"\u56fe\u7247\u8bf4\u660e",viewServer:"\u6d4f\u89c8..."};c.file_manager={emptyFolder:"\u7a7a\u6587\u4ef6\u5939",moveup:"\u79fb\u5230\u4e0a\u4e00\u7ea7\u6587\u4ef6\u5939",viewType:"\u663e\u793a\u65b9\u5f0f\uff1a",viewImage:"\u7f29\u7565\u56fe",listImage:"\u8be6\u7ec6\u4fe1\u606f",orderType:"\u6392\u5e8f\u65b9\u5f0f\uff1a",fileName:"\u540d\u79f0",fileSize:"\u5927\u5c0f",fileType:"\u7c7b\u578b"};c.advtable={cells:"\u5355\u5143\u683c\u6570",rows:"\u884c\u6570",cols:"\u5217\u6570",size:"\u8868\u683c\u5927\u5c0f",
width:"\u5bbd\u5ea6",height:"\u9ad8\u5ea6",percent:"%",px:"px",space:"\u8fb9\u8ddd\u95f4\u8ddd",padding:"\u8fb9\u8ddd",spacing:"\u95f4\u8ddd",align:"\u5bf9\u9f50\u65b9\u5f0f",alignDefault:"\u9ed8\u8ba4",alignLeft:"\u5de6\u5bf9\u9f50",alignCenter:"\u5c45\u4e2d",alignRight:"\u53f3\u5bf9\u9f50",border:"\u8868\u683c\u8fb9\u6846",borderWidth:"\u8fb9\u6846",borderColor:"\u989c\u8272",backgroundColor:"\u80cc\u666f\u989c\u8272"};c.title={h1:"\u6807\u9898 1",h2:"\u6807\u9898 2",h3:"\u6807\u9898 3",h4:"\u6807\u9898 4",
p:"\u6b63 \u6587"};c.fontname={fontName:{SimSun:"\u5b8b\u4f53",NSimSun:"\u65b0\u5b8b\u4f53",FangSong_GB2312:"\u4eff\u5b8b_GB2312",KaiTi_GB2312:"\u6977\u4f53_GB2312",SimHei:"\u9ed1\u4f53","Microsoft YaHei":"\u5fae\u8f6f\u96c5\u9ed1",Arial:"Arial","Arial Black":"Arial Black","Times New Roman":"Times New Roman","Courier New":"Courier New",Tahoma:"Tahoma",Verdana:"Verdana"}}})(KindEditor);
(function(f,c){f.plugin.about={click:function(a){f.util.selection(a);(new f.dialog({id:a,cmd:"about",file:"about.html",width:300,height:70,loadingMode:true,title:f.lang.about,noButton:f.lang.close})).show()}};f.plugin.undo={init:function(a){f.event.ctrl(f.g[a].iframeDoc,"Z",function(){f.plugin.undo.click(a);f.util.focus(a)},a);f.event.ctrl(f.g[a].newTextarea,"Z",function(){f.plugin.undo.click(a);f.util.focus(a)},a)},click:function(a){f.history.undo(a);f.util.execOnchangeHandler(a)}};f.plugin.redo=
{init:function(a){f.event.ctrl(f.g[a].iframeDoc,"Y",function(){f.plugin.redo.click(a);f.util.focus(a)},a);f.event.ctrl(f.g[a].newTextarea,"Y",function(){f.plugin.redo.click(a);f.util.focus(a)},a)},click:function(a){f.history.redo(a);f.util.execOnchangeHandler(a)}};f.plugin.cut={click:function(a){try{if(!f.g[a].iframeDoc.queryCommandSupported("cut"))throw"e";}catch(b){alert(f.lang.cutError);return}f.util.execCommand(a,"cut",null)}};f.plugin.copy={click:function(a){try{if(!f.g[a].iframeDoc.queryCommandSupported("copy"))throw"e";
}catch(b){alert(f.lang.copyError);return}f.util.execCommand(a,"copy",null)}};f.plugin.paste={click:function(a){try{if(!f.g[a].iframeDoc.queryCommandSupported("paste"))throw"e";}catch(b){alert(f.lang.pasteError);return}f.util.execCommand(a,"paste",null)}};f.plugin.plainpaste={click:function(a){f.util.selection(a);this.dialog=new f.dialog({id:a,cmd:"plainpaste",file:"plainpaste.html",width:450,height:300,loadingMode:true,title:f.lang.plainpaste,yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()},
exec:function(a){var b=f.util.getIframeDoc(this.dialog.iframe);b=f.$("textArea",b).value;b=f.util.escape(b);b=b.replace(/ /g,"&nbsp;");b=f.g[a].newlineTag=="p"?b.replace(/^/,"<p>").replace(/$/,"</p>").replace(/\r\n|\n|\r/g,"</p><p>"):b.replace(/\r\n|\n|\r/g,"<br />$&");f.util.insertHtml(a,b);this.dialog.hide();f.util.focus(a)}};f.plugin.wordpaste={click:function(a){f.util.selection(a);this.dialog=new f.dialog({id:a,cmd:"wordpaste",file:"wordpaste.html",width:450,height:300,loadingMode:true,title:f.lang.wordpaste,
yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()},exec:function(a){var b=f.util.getIframeDoc(this.dialog.iframe);b=f.$("wordIframe",b);b=f.util.getIframeDoc(b).body.innerHTML;b=b.replace(/<meta(\n|.)*?>/ig,"");b=b.replace(/<!(\n|.)*?>/ig,"");b=b.replace(/<style[^>]*>(\n|.)*?<\/style>/ig,"");b=b.replace(/<script[^>]*>(\n|.)*?<\/script>/ig,"");b=b.replace(/<w:[^>]+>(\n|.)*?<\/w:[^>]+>/ig,"");b=b.replace(/<xml>(\n|.)*?<\/xml>/ig,"");b=b.replace(/\r\n|\n|\r/ig,"");b=f.util.execGetHtmlHooks(a,
b);b=f.format.getHtml(b,f.g[a].htmlTags,f.g[a].urlType);f.util.insertHtml(a,b);this.dialog.hide();f.util.focus(a)}};f.plugin.fullscreen={click:function(a){var b=f.g[a],d=this,e=function(){var k=f.util.getDocumentElement();b.width=k.clientWidth+"px";b.height=k.clientHeight+"px"},g="",h=function(){if(d.isSelected){var k=f.util.getDocumentElement();k=[k.clientWidth,k.clientHeight].join("");if(g!=k){g=k;e();f.util.resize(a,b.width,b.height)}}};if(this.isSelected){this.isSelected=false;f.util.setData(a);
f.remove(a,1);b.width=this.width;b.height=this.height;f.create(a,2);document.body.parentNode.style.overflow="auto";f.event.remove(window,"resize",h);b.resizeMode=b.config.resizeMode;f.toolbar.unselect(a,"fullscreen")}else{this.isSelected=true;this.width=b.container.style.width;this.height=b.container.style.height;f.util.setData(a);f.remove(a,2);document.body.parentNode.style.overflow="hidden";e();f.create(a,1);var i=f.util.getScrollPos(),j=b.container;j.style.position="absolute";j.style.left=i.x+
"px";j.style.top=i.y+"px";j.style.zIndex=19811211;f.event.add(window,"resize",h);b.resizeMode=0;f.toolbar.select(a,"fullscreen")}}};f.plugin.bgcolor={click:function(a){f.util.selection(a);var b=f.queryCommandValue(f.g[a].iframeDoc,"bgcolor");this.menu=new f.menu({id:a,cmd:"bgcolor"});this.menu.picker(b)},exec:function(a,b){var d=new f.cmd(a);b==""?d.remove({span:[".background-color"]}):d.wrap("span",[{".background-color":b}]);f.util.execOnchangeHandler(a);this.menu.hide();f.util.focus(a)}};f.plugin.fontname=
{click:function(a){var b=f.lang.plugins.fontname.fontName;f.util.selection(a);var d=new f.menu({id:a,cmd:"fontname",width:150}),e=f.queryCommandValue(f.g[a].iframeDoc,"fontname");f.each(b,function(g,h){d.add('<span class="ke-reset" style="font-family: '+g+';">'+h+"</span>",function(){f.plugin.fontname.exec(a,g)},{checked:e===g.toLowerCase()||e===h.toLowerCase()})});d.show();this.menu=d},exec:function(a,b){(new f.cmd(a)).wrap("span",[{".font-family":b}]);f.util.execOnchangeHandler(a);this.menu.hide();
f.util.focus(a)}};f.plugin.fontsize={click:function(a){var b=["9px","10px","12px","14px","16px","18px","24px","32px"];f.util.selection(a);for(var d=f.queryCommandValue(f.g[a].iframeDoc,"fontsize"),e=new f.menu({id:a,cmd:"fontsize",width:120}),g=0,h=b.length;g<h;g++){var i=b[g];e.add('<span class="ke-reset" style="font-size: '+i+';">'+i+"</span>",function(j){return function(){f.plugin.fontsize.exec(a,j)}}(i),{height:parseInt(i)+12+"px",checked:d===i})}e.show();this.menu=e},exec:function(a,b){(new f.cmd(a)).wrap("span",
[{".font-size":b}]);f.util.execOnchangeHandler(a);this.menu.hide();f.util.focus(a)}};f.plugin.hr={click:function(a){f.util.selection(a);f.util.insertHtml(a,"<hr />");f.util.focus(a)}};f.plugin.print={click:function(a){f.util.selection(a);f.g[a].iframeWin.print()}};f.plugin.removeformat={click:function(a){f.util.selection(a);for(var b=new f.cmd(a),d={"*":["class","style"]},e=0,g=f.g[a].inlineTags.length;e<g;e++)d[f.g[a].inlineTags[e]]=["*"];b.remove(d);f.util.execOnchangeHandler(a);f.toolbar.updateState(a);
f.util.focus(a)}};f.plugin.source={click:function(a){var b=f.g[a];if(b.wyswygMode){f.hideMenu(a);b.newTextarea.value=f.util.getData(a);b.iframe.style.display="none";b.newTextarea.style.display="block";f.toolbar.disable(a,["source","fullscreen"]);b.wyswygMode=false;this.isSelected=true;f.toolbar.select(a,"source")}else{f.util.setFullHtml(a,b.newTextarea.value);b.iframe.style.display="block";b.newTextarea.style.display="none";f.toolbar.able(a,["source","fullscreen"]);b.wyswygMode=true;this.isSelected=
false;f.toolbar.unselect(a,"source")}f.util.focus(a)}};f.plugin.textcolor={click:function(a){f.util.selection(a);var b=f.queryCommandValue(f.g[a].iframeDoc,"textcolor");this.menu=new f.menu({id:a,cmd:"textcolor"});this.menu.picker(b)},exec:function(a,b){var d=new f.cmd(a);b==""?d.remove({span:[".color"],font:["color"]}):d.wrap("span",[{".color":b}]);f.util.execOnchangeHandler(a);this.menu.hide();f.util.focus(a)}};f.plugin.title={click:function(a){var b=f.lang.plugins.title;b={H1:b.h1,H2:b.h2,H3:b.h3,
H4:b.h4,P:b.p};var d={H1:28,H2:24,H3:18,H4:14,P:12};f.util.selection(a);var e=f.queryCommandValue(f.g[a].iframeDoc,"formatblock"),g=new f.menu({id:a,cmd:"title",width:f.langType=="en"?200:150});f.each(b,function(h,i){var j="font-size:"+d[h]+"px;";if(h!=="P")j+="font-weight:bold;";g.add('<span class="ke-reset" style="'+j+'">'+i+"</span>",function(){f.plugin.title.exec(a,"<"+h+">")},{height:d[h]+12+"px",checked:e===h.toLowerCase()||e===i.toLowerCase()})});g.show();this.menu=g},exec:function(a,b){f.util.select(a);
f.util.execCommand(a,"formatblock",b);this.menu.hide();f.util.focus(a)}};f.plugin.emoticons={click:function(a){function b(v){var s=f.$$("table");if(r){s.onmouseover=function(){r.style.display="block"};s.onmouseout=function(){r.style.display="none"}}s.className="ke-plugin-emoticons-table";s.cellPadding=0;s.cellSpacing=0;s.border=0;v=(v-1)*j+i;for(var x=0;x<g;x++)for(var w=s.insertRow(x),A=0;A<h;A++){var y=w.insertCell(A);y.className="ke-plugin-emoticons-cell";y.onmouseover=r?function(z,B){return function(){if(z>
l){r.style.left=0;r.style.right=""}else{r.style.left="";r.style.right=0}q.src=p+B+".gif";this.className="ke-plugin-emoticons-cell ke-plugin-emoticons-cell-on"}}(A,v):function(){this.className="ke-plugin-emoticons-cell ke-plugin-emoticons-cell-on"};y.onmouseout=function(){this.className="ke-plugin-emoticons-cell"};y.onclick=function(z){return function(){e.exec(a,z);return false}}(v);var u=f.$$("span");u.className="ke-plugin-emoticons-img";u.style.backgroundPosition="-"+24*v+"px 0px";y.appendChild(u);
v++}return s}function d(v){for(var s=1;s<=k;s++){if(v!==s){var x=f.$$("a");x.href="javascript:;";x.innerHTML="["+s+"]";x.onclick=function(w){return function(){n.removeChild(t);var A=b(w);n.insertBefore(A,m);t=A;m.innerHTML="";d(w);return false}}(s);m.appendChild(x)}else m.appendChild(document.createTextNode("["+s+"]"));m.appendChild(document.createTextNode(" "))}}var e=this,g=5,h=9,i=0,j=g*h,k=Math.ceil(135/j),l=Math.floor(h/2),o=f.g[a],p=o.pluginsPath+"emoticons/";o=o.allowPreviewEmoticons===c?true:
o.allowPreviewEmoticons;f.util.selection(a);var n=f.$$("div");n.className="ke-plugin-emoticons-wrapper";var r,q;if(o){r=f.$$("div");r.className="ke-plugin-emoticons-preview";r.style.right=0;q=f.$$("img");q.className="ke-reset";q.src=p+"0.gif";q.border=0;r.appendChild(q);n.appendChild(r)}var t=b(1);n.appendChild(t);var m=f.$$("div");m.className="ke-plugin-emoticons-page";n.appendChild(m);d(1);o=new f.menu({id:a,cmd:"emoticons"});o.append(n);o.show();this.menu=o},exec:function(a,b){var d=f.g[a].pluginsPath+
"emoticons/"+b+".gif";f.util.insertHtml(a,'<img src="'+d+'" kesrc="'+d+'" border="0" alt="" />');this.menu.hide();f.util.focus(a)}};f.plugin.flash={init:function(a){f.g[a].getHtmlHooks.push(function(b){return b.replace(/<img[^>]*class="?ke-flash"?[^>]*>/ig,function(d){var e=d.match(/style="[^"]*;?\s*width:\s*(\d+)/i)?RegExp.$1:0,g=d.match(/style="[^"]*;?\s*height:\s*(\d+)/i)?RegExp.$1:0;e=e||(d.match(/width="([^"]+)"/i)?RegExp.$1:0);g=g||(d.match(/height="([^"]+)"/i)?RegExp.$1:0);if(d.match(/kesrctag="([^"]+)"/i)){d=
f.util.getAttrList(unescape(RegExp.$1));d.width=e||d.width||0;d.height=g||d.height||0;d.kesrc=d.src;return f.util.getMediaEmbed(d)}})});f.g[a].setHtmlHooks.push(function(b){return b.replace(/<embed[^>]*type="application\/x-shockwave-flash"[^>]*>(?:<\/embed>)?/ig,function(d){var e=d.match(/\s+src="([^"]+)"/i)?RegExp.$1:"";if(d.match(/\s+kesrc="([^"]+)"/i))e=RegExp.$1;var g=d.match(/\s+width="([^"]+)"/i)?RegExp.$1:0,h=d.match(/\s+height="([^"]+)"/i)?RegExp.$1:0;d=f.util.getAttrList(d);d.src=e;d.width=
g;d.height=h;return f.util.getMediaImage(a,"flash",d)})})},click:function(a){f.util.selection(a);this.dialog=new f.dialog({id:a,cmd:"flash",file:"flash.html",width:400,height:140,loadingMode:true,title:f.lang.flash,yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()},check:function(a,b,d,e){a=f.util.getIframeDoc(this.dialog.iframe);if(!b.match(/^.{3,}$/)){alert(f.lang.invalidUrl);f.$("url",a).focus();return false}if(!d.match(/^\d*$/)){alert(f.lang.invalidWidth);f.$("width",a).focus();return false}if(!e.match(/^\d*$/)){alert(f.lang.invalidHeight);
f.$("height",a).focus();return false}return true},exec:function(a){var b=f.util.getIframeDoc(this.dialog.iframe),d=f.$("url",b).value,e=f.$("width",b).value;b=f.$("height",b).value;if(!this.check(a,d,e,b))return false;d=f.util.getMediaImage(a,"flash",{src:d,type:f.g[a].mediaTypes.flash,width:e,height:b,quality:"high"});f.util.insertHtml(a,d);this.dialog.hide();f.util.focus(a)}};f.plugin.image={getSelectedNode:function(a){a=f.g[a];var b=a.keRange.startNode,d=a.keRange.endNode;if(f.browser.WEBKIT||
a.keSel.isControl)if(b.nodeType==1)if(b.tagName.toLowerCase()=="img")if(b==d)if(!b.className.match(/^ke-\w+/i))return b},init:function(a){var b=this;a=f.g[a];a.contextmenuItems.push({text:f.lang.editImage,click:function(d,e){f.util.select(d);e.hide();b.click(d)},cond:function(d){return b.getSelectedNode(d)},options:{width:"150px",iconHtml:'<span class="ke-common-icon ke-common-icon-url ke-icon-image"></span>'}});a.contextmenuItems.push({text:f.lang.deleteImage,click:function(d,e){f.util.select(d);
e.hide();var g=b.getSelectedNode(d);g.parentNode.removeChild(g);f.util.execOnchangeHandler(d)},cond:function(d){return b.getSelectedNode(d)},options:{width:"150px"}});a.contextmenuItems.push("-")},click:function(a){f.util.selection(a);this.dialog=new f.dialog({id:a,cmd:"image",file:"image/image.html",width:400,height:220,loadingMode:true,title:f.lang.image,yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()},check:function(){var a=f.util.getIframeDoc(this.dialog.iframe),b=f.$("type",a).value,
d=f.$("imgWidth",a).value,e=f.$("imgHeight",a).value;f.$("imgTitle",a);b=b==2?f.$("imgFile",a):f.$("url",a);if(!b.value.match(/\.(jpg|jpeg|gif|bmp|png)(\s|\?|$)/i)){alert(f.lang.invalidImg);b.focus();return false}if(!d.match(/^\d*$/)){alert(f.lang.invalidWidth);f.$("imgWidth",a).focus();return false}if(!e.match(/^\d*$/)){alert(f.lang.invalidHeight);f.$("imgHeight",a).focus();return false}return true},exec:function(a){for(var b=this,d=f.util.getIframeDoc(this.dialog.iframe),e=f.$("type",d).value,g=
f.$("imgWidth",d).value,h=f.$("imgHeight",d).value,i=f.$("imgTitle",d).value,j=d.getElementsByName("align"),k="",l=0,o=j.length;l<o;l++)if(j[l].checked){k=j[l].value;break}if(!this.check(a))return false;if(e==2){f.$("editorId",d).value=a;var p=f.$("uploadIframe",d);f.util.showLoadingPage(a);var n=function(){f.event.remove(p,"load",n);f.util.hideLoadingPage(a);var r=f.util.getIframeDoc(p),q="";try{q=f.util.parseJson(r.body.innerHTML)}catch(t){alert(f.lang.invalidJson)}if(typeof q==="object"&&"error"in
q)if(q.error===0){r=f.format.getUrl(q.url,"absolute");b.insert(a,r,i,g,h,0,k)}else{alert(q.message);return false}};f.event.add(p,"load",n);d.uploadForm.submit()}else{d=f.$("url",d).value;this.insert(a,d,i,g,h,0,k)}},insert:function(a,b,d,e,g,h,i){b='<img src="'+b+'" kesrc="'+b+'" ';if(e>0)b+='width="'+e+'" ';if(g>0)b+='height="'+g+'" ';if(d)b+='title="'+d+'" ';if(i)b+='align="'+i+'" ';b+='alt="'+d+'" ';b+='border="'+h+'" />';f.util.insertHtml(a,b);this.dialog.hide();f.util.focus(a)}};f.plugin.link=
{getSelectedNode:function(a){return f.getCommonAncestor(f.g[a].keSel,"a")},init:function(a){var b=this;f.g[a].contextmenuItems.push({text:f.lang.editLink,click:function(d,e){f.util.select(d);e.hide();b.click(d)},cond:function(d){return b.getSelectedNode(d)},options:{width:"150px",iconHtml:'<span class="ke-common-icon ke-common-icon-url ke-icon-link"></span>'}})},click:function(a){f.util.selection(a);this.dialog=new f.dialog({id:a,cmd:"link",file:"link/link.html",width:400,height:90,loadingMode:true,
title:f.lang.link,yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()},exec:function(a){var b=f.g[a];f.util.select(a);var d=b.keRange,e=d.startNode,g=d.endNode,h=b.iframeDoc,i=f.util.getIframeDoc(this.dialog.iframe),j=f.$("hyperLink",i).value,k=f.$("linkType",i).value;if(!j.match(/.+/)||j.match(/^\w+:\/\/\/?$/)){alert(f.lang.invalidUrl);f.$("hyperLink",i).focus();return false}for(i=d.getParentElement();i;){if(i.tagName.toLowerCase()=="a"||i.tagName.toLowerCase()=="body")break;i=i.parentNode}i=
i.parentNode;g=f.browser.IE?!!b.range.item:e.nodeType==1&&e===g&&e.nodeName.toLowerCase()!="br";var l=!g;g||(l=f.browser.IE?b.range.text==="":b.range.toString()==="");if(l||f.util.isEmpty(a)){b='<a href="'+j+'"';if(k)b+=' target="'+k+'"';b+=">"+j+"</a>";f.util.insertHtml(a,b)}else{h.execCommand("createlink",false,"__ke_temp_url__");i=i.getElementsByTagName("a");l=0;for(var o=i.length;l<o;l++)if(i[l].href.match(/\/?__ke_temp_url__$/)){i[l].href=j;i[l].setAttribute("kesrc",j);if(k)i[l].target=k;else i[l].removeAttribute("target")}if(f.browser.WEBKIT&&
g&&e.tagName.toLowerCase()=="img"){g=e.parentNode;if(g.tagName.toLowerCase()!="a"){h=f.$$("a",h);g.insertBefore(h,e);h.appendChild(e);g=h}g.href=j;g.setAttribute("kesrc",j);if(k)g.target=k;else g.removeAttribute("target");b.keSel.addRange(d)}}f.util.execOnchangeHandler(a);this.dialog.hide();f.util.focus(a)}};f.plugin.unlink={init:function(a){var b=this;f.g[a].contextmenuItems.push({text:f.lang.deleteLink,click:function(d,e){f.util.select(d);e.hide();b.click(d)},cond:function(d){return f.plugin.link.getSelectedNode(d)},
options:{width:"150px",iconHtml:'<span class="ke-common-icon ke-common-icon-url ke-icon-unlink"></span>'}});f.g[a].contextmenuItems.push("-")},click:function(a){var b=f.g[a],d=b.iframeDoc;f.util.selection(a);var e=b.keRange,g=e.startNode;e=e.endNode;e=g.nodeType==1&&g===e;var h=!e;e||(h=f.browser.IE?b.range.text==="":b.range.toString()==="");if(h){h=f.plugin.link.getSelectedNode(a);if(!h)return;e=b.keRange;e.selectTextNode(h);b.keSel.addRange(e);f.util.select(a);d.execCommand("unlink",false,null);
if(f.browser.WEBKIT&&g.tagName.toLowerCase()=="img"){d=g.parentNode;if(d.tagName.toLowerCase()=="a"){f.util.removeParent(d);b.keSel.addRange(e)}}}else d.execCommand("unlink",false,null);f.util.execOnchangeHandler(a);f.toolbar.updateState(a);f.util.focus(a)}};f.plugin.media={init:function(a){var b={};f.each(f.g[a].mediaTypes,function(d,e){b[e]=d});f.g[a].getHtmlHooks.push(function(d){return d.replace(/<img[^>]*class="?ke-\w+"?[^>]*>/ig,function(e){var g=e.match(/style="[^"]*;?\s*width:\s*(\d+)/i)?
RegExp.$1:0,h=e.match(/style="[^"]*;?\s*height:\s*(\d+)/i)?RegExp.$1:0;g=g||(e.match(/width="([^"]+)"/i)?RegExp.$1:0);h=h||(e.match(/height="([^"]+)"/i)?RegExp.$1:0);if(e.match(/\s+kesrctag="([^"]+)"/i)){e=f.util.getAttrList(unescape(RegExp.$1));e.width=g||e.width||0;e.height=h||e.height||0;e.kesrc=e.src;return f.util.getMediaEmbed(e)}})});f.g[a].setHtmlHooks.push(function(d){return d.replace(/<embed[^>]*type="([^"]+)"[^>]*>(?:<\/embed>)?/ig,function(e,g){if(typeof b[g]=="undefined")return e;var h=
e.match(/\s+src="([^"]+)"/i)?RegExp.$1:"";if(e.match(/\s+kesrc="([^"]+)"/i))h=RegExp.$1;var i=e.match(/\s+width="([^"]+)"/i)?RegExp.$1:0,j=e.match(/\s+height="([^"]+)"/i)?RegExp.$1:0,k=f.util.getAttrList(e);k.src=h;k.width=i;k.height=j;return f.util.getMediaImage(a,"",k)})})},click:function(a){f.util.selection(a);this.dialog=new f.dialog({id:a,cmd:"media",file:"media.html",width:400,height:170,loadingMode:true,title:f.lang.media,yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()},check:function(a,
b,d,e){a=f.util.getIframeDoc(this.dialog.iframe);if(!b.match(/^.{3,}\.(swf|flv|mp3|wav|wma|wmv|mid|avi|mpg|mpeg|asf|rm|rmvb)(\?|$)/i)){alert(f.lang.invalidMedia);f.$("url",a).focus();return false}if(!d.match(/^\d*$/)){alert(f.lang.invalidWidth);f.$("width",a).focus();return false}if(!e.match(/^\d*$/)){alert(f.lang.invalidHeight);f.$("height",a).focus();return false}return true},exec:function(a){var b=f.util.getIframeDoc(this.dialog.iframe),d=f.$("url",b).value,e=f.$("width",b).value,g=f.$("height",
b).value;if(!this.check(a,d,e,g))return false;b=f.$("autostart",b).checked?"true":"false";d=f.util.getMediaImage(a,"",{src:d,type:f.g[a].mediaTypes[f.util.getMediaType(d)],width:e,height:g,autostart:b,loop:"true"});f.util.insertHtml(a,d);this.dialog.hide();f.util.focus(a)}};f.plugin.advtable={getSelectedTable:function(a){return f.getCommonAncestor(f.g[a].keSel,"table")},getSelectedRow:function(a){return f.getCommonAncestor(f.g[a].keSel,"tr")},getSelectedCell:function(a){return f.getCommonAncestor(f.g[a].keSel,
"td")},tableprop:function(a){this.click(a)},tableinsert:function(a){this.click(a,"insert")},tabledelete:function(a){a=this.getSelectedTable(a);a.parentNode.removeChild(a)},tablecolinsert:function(a,b){for(var d=this.getSelectedTable(a),e=this.getSelectedCell(a).cellIndex+b,g=0,h=d.rows.length;g<h;g++)d.rows[g].insertCell(e).innerHTML="&nbsp;"},tablecolinsertleft:function(a){this.tablecolinsert(a,0)},tablecolinsertright:function(a){this.tablecolinsert(a,1)},tablerowinsert:function(a,b){var d=this.getSelectedTable(a),
e=this.getSelectedRow(a);d=d.insertRow(e.rowIndex+b);var g=0;for(e=e.cells.length;g<e;g++)d.insertCell(g).innerHTML="&nbsp;"},tablerowinsertabove:function(a){this.tablerowinsert(a,0)},tablerowinsertbelow:function(a){this.tablerowinsert(a,1)},tablecoldelete:function(a){var b=this.getSelectedTable(a);a=this.getSelectedCell(a).cellIndex;for(var d=0,e=b.rows.length;d<e;d++)b.rows[d].deleteCell(a)},tablerowdelete:function(a){var b=this.getSelectedTable(a);a=this.getSelectedRow(a);b.deleteRow(a.rowIndex)},
init:function(a){for(var b=this,d="prop,colinsertleft,colinsertright,rowinsertabove,rowinsertbelow,coldelete,rowdelete,insert,delete".split(","),e=0,g=d.length;e<g;e++){var h="table"+d[e];f.g[a].contextmenuItems.push({text:f.lang[h],click:function(i){return function(j,k){f.util.select(j);k.hide();b[i]!==c&&b[i](j);/prop/.test(i)||f.util.execOnchangeHandler(j)}}(h),cond:function(i){return f.util.inArray(i,["tableprop","tabledelete"])?function(j){return b.getSelectedTable(j)}:function(j){return b.getSelectedCell(j)}}(h),
options:{width:"170px",iconHtml:'<span class="ke-common-icon ke-common-icon-url ke-icon-'+h+'"></span>'}})}f.g[a].contextmenuItems.push("-");f.g[a].setHtmlHooks.push(function(i){return i.replace(/<table([^>]*)>/ig,function(j,k){if(k.match(/\s+border=["']?(\d*)["']?/ig)){var l=RegExp.$1;return k.indexOf("ke-zeroborder")<0&&(l===""||l==="0")?f.addClass(j,"ke-zeroborder"):j}else return f.addClass(j,"ke-zeroborder")})})},click:function(a,b){b=b||"default";f.util.selection(a);this.dialog=new f.dialog({id:a,
cmd:"advtable",file:"advtable/advtable.html?mode="+b,width:420,height:220,loadingMode:true,title:f.lang.advtable,yesButton:f.lang.yes,noButton:f.lang.no});this.dialog.show()},exec:function(a){var b=f.util.getIframeDoc(this.dialog.iframe),d=f.$("mode",b),e=f.$("rows",b),g=f.$("cols",b),h=f.$("width",b),i=f.$("height",b),j=f.$("widthType",b),k=f.$("heightType",b),l=f.$("padding",b),o=f.$("spacing",b),p=f.$("align",b),n=f.$("border",b),r=f.$("borderColor",b),q=f.$("backgroundColor",b);b=e.value;var t=
g.value,m=h.value,v=i.value;j=j.value;var s=k.value;k=l.value;var x=o.value;p=p.value;var w=n.value;r=r.innerHTML;q=q.innerHTML;if(b==""||b==0||!b.match(/^\d*$/)){alert(f.lang.invalidRows);e.focus();return false}if(t==""||t==0||!t.match(/^\d*$/)){alert(f.lang.invalidCols);g.focus();return false}if(!m.match(/^\d*$/)){alert(f.lang.invalidWidth);h.focus();return false}if(!v.match(/^\d*$/)){alert(f.lang.invalidHeight);i.focus();return false}if(!k.match(/^\d*$/)){alert(f.lang.invalidPadding);l.focus();
return false}if(!x.match(/^\d*$/)){alert(f.lang.invalidSpacing);o.focus();return false}if(!w.match(/^\d*$/)){alert(f.lang.invalidBorder);n.focus();return false}if(d.value==="update"){b=this.getSelectedTable(a);if(m!=="")b.style.width=m+j;else if(b.style.width)b.style.width="";b.width!==c&&b.removeAttribute("width");if(v!=="")b.style.height=v+s;else if(b.style.height)b.style.height="";b.height!==c&&b.removeAttribute("height");if(q!=="")b.style.backgroundColor=q;else if(b.style.backgroundColor)b.style.backgroundColor=
"";b.bgColor!==c&&b.removeAttribute("bgColor");if(k!=="")b.cellPadding=k;else b.removeAttribute("cellPadding");if(x!=="")b.cellSpacing=x;else b.removeAttribute("cellSpacing");if(p!=="")b.align=p;else b.removeAttribute("align");w===""||w==="0"?f.addClass(b,"ke-zeroborder"):f.removeClass(b,"ke-zeroborder");w!==""?b.setAttribute("border",w):b.removeAttribute("border");r!==""?b.setAttribute("borderColor",r):b.removeAttribute("borderColor");f.util.execOnchangeHandler(a)}else{d="";if(m!=="")d+="width:"+
m+j+";";if(v!=="")d+="height:"+v+s+";";if(q!=="")d+="background-color:"+q+";";m="<table";if(d!=="")m+=' style="'+d+'"';if(k!=="")m+=' cellpadding="'+k+'"';if(x!=="")m+=' cellspacing="'+x+'"';if(p!=="")m+=' align="'+p+'"';if(w===""||w==="0")m+=' class="ke-zeroborder"';if(w!=="")m+=' border="'+w+'"';if(r!=="")m+=' bordercolor="'+r+'"';m+=">";for(v=0;v<b;v++){m+="<tr>";for(d=0;d<t;d++)m+="<td>&nbsp;</td>";m+="</tr>"}m+="</table>";f.util.insertHtml(a,m)}this.dialog.hide();f.util.focus(a)}}})(KindEditor);
