/* KindEditor 4.1.9 (2013-10-08), Copyright (C) kindsoft.net, Licence: http://www.kindsoft.net/license.php */(function(b,d){function f(a){if(!a)return!1;return Object.prototype.toString.call(a)==="[object Array]"}function l(a){if(!a)return!1;return Object.prototype.toString.call(a)==="[object Function]"}function e(a,c){for(var g=0,b=c.length;g=0}function j(a,c){c=c||"px";return a&&/^\d+$/.test(a)?a+c:a}function o(a){var c;return a&&(c=/(\d+)/.exec(a))?parseInt(c[1],10):0}function t(a){return a.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function w(a){return a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function p(a){var c=a.split("-"),a="";h(c,function(c,b){a+=c>0?b.charAt(0).toUpperCase()+ b.substr(1):b});return a}function s(a){function c(a){a=parseInt(a,10).toString(16).toUpperCase();return a.length>1?a:"0"+a}return a.replace(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/ig,function(a,b,d,k){return"#"+c(b)+c(d)+c(k)})}function z(a,c){var c=c===d?",":c,g={},b=f(a)?a:a.split(c),q;h(b,function(a,c){if(q=/^(\d+)\.\.(\d+)$/.exec(c))for(var b=parseInt(q[1],10);b<=parseInt(q[2],10);b++)g[b.toString()]=!0;else g[c]=!0});return g}function D(a,c){return Array.prototype.slice.call(a,c||0)}function r(a, c){return a===d?c:a}function A(a,c,g){g||(g=c,c=null);var b;if(c){var d=function(){};d.prototype=c.prototype;b=new d;h(g,function(a,c){b[a]=c})}else b=g;b.constructor=a;a.prototype=b;a.parent=c?c.prototype:null}function B(a){var c;if(c=/\{[\s\S]*\}|\[[\s\S]*\]/.exec(a))a=c[0];c=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;c.lastIndex=0;c.test(a)&&(a=a.replace(c,function(a){return"\\u"+("0000"+a.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";}function G(a,c,g){a.addEventListener?a.addEventListener(c,g,fb):a.attachEvent&&a.attachEvent("on"+c,g)}function C(a,c,g){a.removeEventListener?a.removeEventListener(c,g,fb):a.detachEvent&&a.detachEvent("on"+c,g)}function v(a,c){this.init(a,c)}function I(a){try{delete a[ma]}catch(c){a.removeAttribute&& a.removeAttribute(ma)}}function E(a,c,g){if(c.indexOf(",")>=0)h(c.split(","),function(){E(a,this,g)});else{var b=a[ma]||null;b||(a[ma]=++gb,b=gb);L[b]===d&&(L[b]={});var q=L[b][c];q&&q.length>0?C(a,c,q[0]):(L[b][c]=[],L[b].el=a);q=L[b][c];q.length===0&&(q[0]=function(c){var g=c?new v(a,c):d;h(q,function(c,b){c>0&&b&&b.call(a,g)})});e(g,q)<0&&q.push(g);G(a,c,q[0])}}function T(a,c,g){if(c&&c.indexOf(",")>=0)h(c.split(","),function(){T(a,this,g)});else{var b=a[ma]||null;if(b)if(c===d)b in L&&(h(L[b], function(c,g){c!="el"&&g.length>0&&C(a,c,g[0])}),delete L[b],I(a));else if(L[b]){var q=L[b][c];if(q&&q.length>0){g===d?(C(a,c,q[0]),delete L[b][c]):(h(q,function(a,c){a>0&&c===g&&q.splice(a,1)}),q.length==1&&(C(a,c,q[0]),delete L[b][c]));var k=0;h(L[b],function(){k++});k<2&&(delete L[b],I(a))}}}}function qa(a,c){if(c.indexOf(",")>=0)h(c.split(","),function(){qa(a,this)});else{var g=a[ma]||null;if(g){var b=L[g][c];if(L[g]&&b&&b.length>0)b[0]()}}}function $(a,c,g){c=/^\d{2,}$/.test(c)?c:c.toUpperCase().charCodeAt(0); E(a,"keydown",function(b){b.ctrlKey&&b.which==c&&!b.shiftKey&&!b.altKey&&(g.call(a),b.stop())})}function M(a){for(var c={},g=/\s*([\w\-]+)\s*:([^;]*)(;|$)/g,b;b=g.exec(a);){var d=n(b[1].toLowerCase());b=n(s(b[2]));c[d]=b}return c}function K(a){for(var c={},g=/\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g,b;b=g.exec(a);){var d=(b[1]||b[2]||b[4]||b[6]).toLowerCase();c[d]=(b[2]?b[3]:b[4]?b[5]:b[7])||""}return c}function O(a,c){return a= /\s+class\s*=/.test(a)?a.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/,function(a,b,d,k){return(" "+d+" ").indexOf(" "+c+" ")<0?d===""?b+c+k:b+d+" "+c+k:a}):a.substr(0,a.length-1)+' class="'+c+'">'}function Q(a){var c="";h(M(a),function(a,b){c+=a+":"+b+";"});return c}function R(a,c,g,b){function q(a){for(var a=a.split("/"),c=[],g=0,b=a.length;g0&&c.pop():d!==""&&d!="."&&c.push(d)}return"/"+c.join("/")}function k(c,g){if(a.substr(0,c.length)===c){for(var d=[],q= 0;q0&&(q+="/"+d.join("/"));b=="/"&&(q+="/");return q+a.substr(c.length)}else if(i=/^(.*)\//.exec(c))return k(i[1],++g)}c=r(c,"").toLowerCase();a.substr(0,5)!="data:"&&(a=a.replace(/([^:])\/\//g,"$1/"));if(e(c,["absolute","relative","domain"])<0)return a;g=g||location.protocol+"//"+location.host;if(b===d)var u=location.pathname.match(/^(\/.*)\//),b=u?u[1]:"";var i;if(i=/^(\w+:\/\/[^\/]*)/.exec(a)){if(i[1]!==g)return a}else if(/^\w+:/.test(a))return a;/^\//.test(a)? a=g+q(a.substr(1)):/^\w+:\/\//.test(a)||(a=g+q(b+"/"+a));c==="relative"?a=k(g+b,0).substr(2):c==="absolute"&&a.substr(0,g.length)===g&&(a=a.substr(g.length));return a}function H(a,c,g,b,d){a==null&&(a="");var g=g||"",b=r(b,!1),d=r(d,"\t"),k="xx-small,x-small,small,medium,large,x-large,xx-large".split(","),a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig,function(a,c,g,b){return c+g.replace(/<(?:br|br\s[^>]*)>/ig,"\n")+b}),a=a.replace(/<(?:br|br\s[^>]*)\s*\/?>\s*<\/p>/ig,"

"),a=a.replace(/(<(?:p|p\s[^>]*)>)\s*(<\/p>)/ig, "$1
$2"),a=a.replace(/\u200B/g,""),a=a.replace(/\u00A9/g,"©"),a=a.replace(/<[^>]+>/g,function(a){return a.replace(/\s+/g," ")}),u={};c&&(h(c,function(a,c){for(var g=a.split(","),b=0,d=g.length;b]*)>)([\s\S]*?)(<\/script>)/ig,"")),u.style||(a=a.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/ig,"")));var i=[],a=a.replace(/(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g, function(a,f,m,o,j,l,t){var f=f||"",m=m||"",n=o.toLowerCase(),s=j||"",o=l?" "+l:"",t=t||"";if(c&&!u[n])return"";o===""&&hb[n]&&(o=" /");ib[n]&&(f&&(f=" "),t&&(t=" "));Ma[n]&&(m?t="\n":f="\n");b&&n=="br"&&(t="\n");if(jb[n]&&!Ma[n])if(b){m&&i.length>0&&i[i.length-1]===n?i.pop():i.push(n);t=f="\n";j=0;for(l=m?i.length:i.length-1;j=0&&(p[a]=R(b,g));(c&&a!=="style"&&!u[n]["*"]&&!u[n][a]||n==="body"&&a==="contenteditable"||/^kindeditor_\d+$/.test(a))&&delete p[a];if(a==="style"&&b!==""){var d=M(b);h(d,function(a){c&&!u[n].style&&!u[n]["."+a]&&delete d[a]}); var V="";h(d,function(a,c){V+=a+":"+c+";"});p.style=V}});s="";h(p,function(a,c){a==="style"&&c===""||(c=c.replace(/"/g,"""),s+=" "+a+'="'+c+'"')})}n==="font"&&(n="span");return f+"<"+m+n+s+o+">"+t}),a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig,function(a,c,g,b){return c+g.replace(/\n/g,'\n')+b}),a=a.replace(/\n\s*\n/g,"\n"),a=a.replace(/\n/g,"\n");return n(a)}function U(a,c){a=a.replace(//ig, "").replace(//ig,"").replace(/]*>[\s\S]*?<\/style>/ig,"").replace(/]*>[\s\S]*?<\/script>/ig,"").replace(/]+>[\s\S]*?<\/w:[^>]+>/ig,"").replace(/]+>[\s\S]*?<\/o:[^>]+>/ig,"").replace(/[\s\S]*?<\/xml>/ig,"").replace(/<(?:table|td)[^>]*>/ig,function(a){return a.replace(/border-bottom:([#\w\s]+)/ig,"border:$1")});return H(a,c)}function W(a){if(/\.(rm|rmvb)(\?|$)/i.test(a))return"audio/x-pn-realaudio-plugin";if(/\.(swf|flv)(\?|$)/i.test(a))return"application/x-shockwave-flash"; return"video/x-ms-asf-plugin"}function S(a){return K(unescape(a))}function Na(a){var c="0&&(u+="width:"+g+"px;");/\D/.test(b)?u+="height:"+b+";":b>0&&(u+="height:"+b+"px;");g=/realaudio/i.test(d)?"ke-rm":/flash/i.test(d)?"ke-flash":"ke-media";g='';return g}function Da(a,c){if(a.nodeType==9&&c.nodeType!=9)return!0;for(;c=c.parentNode;)if(c==a)return!0;return!1}function Ea(a,c){var c=c.toLowerCase(),g=null;if(!Mb&&a.nodeName.toLowerCase()!="script"){var b=a.ownerDocument.createElement("div");b.appendChild(a.cloneNode(!1));b=K(w(b.innerHTML));c in b&&(g=b[c])}else try{g=a.getAttribute(c,2)}catch(d){g=a.getAttribute(c,1)}c==="style"&&g!==null&&(g=Q(g));return g}function Fa(a,c){function g(a){if(typeof a!="string")return a;return a.replace(/([^\w\-])/g, "\\$1")}function b(a,c){return a==="*"||a.toLowerCase()===g(c.toLowerCase())}function d(a,c,g){var q=[];(a=(g.ownerDocument||g).getElementById(a.replace(/\\/g,"")))&&b(c,a.nodeName)&&Da(g,a)&&q.push(a);return q}function k(a,c,g){var d=g.ownerDocument||g,q=[],k,u,i;if(g.getElementsByClassName){d=g.getElementsByClassName(a.replace(/\\/g,""));k=0;for(u=d.length;k-1&&q.push(i)}return q}function u(a,c,b,d){for(var q=[],b=d.getElementsByTagName(b),V=0,k=b.length;V])+)/.exec(a))?e[1]:"*";if(e=/#((?:[\w\-]|\\.)+)$/.exec(a))g= d(e[1],f,c);else if(e=/\.((?:[\w\-]|\\.)+)$/.exec(a))g=k(e[1],f,c);else if(e=/\[((?:[\w\-]|\\.)+)\]/.exec(a))g=u(e[1].toLowerCase(),null,f,c);else if(e=/\[((?:[\w\-]|\\.)+)\s*=\s*['"]?((?:\\.|[^'"]+)+)['"]?\]/.exec(a)){g=e[1].toLowerCase();e=e[2];if(g==="id")f=d(e,f,c);else if(g==="class")f=k(e,f,c);else if(g==="name"){g=[];e=(c.ownerDocument||c).getElementsByName(e.replace(/\\/g,""));for(var Z,h=0,o=e.length;h1){var m=[];h(f,function(){h(Fa(this,c),function(){e(this,m)<0&&m.push(this)})});return m}for(var c=c||document,f=[],o,j=/((?:\\.|[^\s>])+|[\s>])/g;o=j.exec(a);)o[1]!==" "&&f.push(o[1]);o=[];if(f.length==1)return i(f[0],c);var j=!1,n,t,l,s,p,w,r,B,E,v;w=0;for(lenth=f.length;w")j=!0;else{if(w>0){t=[];r=0;for(E=o.length;r