/* KindEditor 4.1.5 (2013-01-20), Copyright (C) kindsoft.net, Licence: http://www.kindsoft.net/license.php */(function(b,c){function g(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 f(a,d){for(var e=0,b=d.length;e=0}function o(a,d){d=d||"px";return a&&/^\d+$/.test(a)?a+d:a}function j(a){var d;return a&&(d=/(\d+)/.exec(a))?parseInt(d[1],10):0}function q(a){return a.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function s(a){return a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function r(a){var d=a.split("-"),a="";i(d,function(d,b){a+=d>0?b.charAt(0).toUpperCase()+ b.substr(1):b});return a}function v(a){function d(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,c,k){return"#"+d(b)+d(c)+d(k)})}function z(a,d){var d=d===c?",":d,e={},b=g(a)?a:a.split(d),u;i(b,function(a,d){if(u=/^(\d+)\.\.(\d+)$/.exec(d))for(var b=parseInt(u[1],10);b<=parseInt(u[2],10);b++)e[b.toString()]=!0;else e[d]=!0});return e}function D(a,d){return Array.prototype.slice.call(a,d||0)}function p(a, d){return a===c?d:a}function B(a,d,e){e||(e=d,d=null);var b;if(d){var c=function(){};c.prototype=d.prototype;b=new c;i(e,function(a,d){b[a]=d})}else b=e;b.constructor=a;a.prototype=b;a.parent=d?d.prototype:null}function A(a){var d;if(d=/\{[\s\S]*\}|\[[\s\S]*\]/.exec(a))a=d[0];d=/[\u0000\u00ad\u0600-\u0604\u070f\u17b4\u17b5\u200c-\u200f\u2028-\u202f\u2060-\u206f\ufeff\ufff0-\uffff]/g;d.lastIndex=0;d.test(a)&&(a=a.replace(d,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 F(a,d,e){a.addEventListener?a.addEventListener(d,e,cb):a.attachEvent&&a.attachEvent("on"+d,e)}function w(a,d,e){a.removeEventListener?a.removeEventListener(d,e,cb):a.detachEvent&&a.detachEvent("on"+d,e)}function E(a,d){this.init(a,d)}function G(a){try{delete a[ka]}catch(d){a.removeAttribute&& a.removeAttribute(ka)}}function R(a,d,e){if(d.indexOf(",")>=0)i(d.split(","),function(){R(a,this,e)});else{var b=a[ka]||null;b||(a[ka]=++db,b=db);L[b]===c&&(L[b]={});var u=L[b][d];u&&u.length>0?w(a,d,u[0]):(L[b][d]=[],L[b].el=a);u=L[b][d];u.length===0&&(u[0]=function(d){var e=d?new E(a,d):c;i(u,function(d,b){d>0&&b&&b.call(a,e)})});f(e,u)<0&&u.push(e);F(a,d,u[0])}}function U(a,d,e){if(d&&d.indexOf(",")>=0)i(d.split(","),function(){U(a,this,e)});else{var b=a[ka]||null;if(b)if(d===c)b in L&&(i(L[b], function(d,e){d!="el"&&e.length>0&&w(a,d,e[0])}),delete L[b],G(a));else if(L[b]){var u=L[b][d];if(u&&u.length>0){e===c?(w(a,d,u[0]),delete L[b][d]):(i(u,function(a,d){a>0&&d===e&&u.splice(a,1)}),u.length==1&&(w(a,d,u[0]),delete L[b][d]));var k=0;i(L[b],function(){k++});k<2&&(delete L[b],G(a))}}}}function aa(a,d){if(d.indexOf(",")>=0)i(d.split(","),function(){aa(a,this)});else{var e=a[ka]||null;if(e){var b=L[e][d];if(L[e]&&b&&b.length>0)b[0]()}}}function P(a,d,e){d=/^\d{2,}$/.test(d)?d:d.toUpperCase().charCodeAt(0); R(a,"keydown",function(b){b.ctrlKey&&b.which==d&&!b.shiftKey&&!b.altKey&&(e.call(a),b.stop())})}function O(a){for(var d={},e=/\s*([\w\-]+)\s*:([^;]*)(;|$)/g,b;b=e.exec(a);){var c=n(b[1].toLowerCase());b=n(v(b[2]));d[c]=b}return d}function H(a){for(var d={},e=/\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g,b;b=e.exec(a);){var c=(b[1]||b[2]||b[4]||b[6]).toLowerCase();d[c]=(b[2]?b[3]:b[4]?b[5]:b[7])||""}return d}function S(a,d){return a= /\s+class\s*=/.test(a)?a.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/,function(a,b,c,k){return(" "+c+" ").indexOf(" "+d+" ")<0?c===""?b+d+k:b+c+" "+d+k:a}):a.substr(0,a.length-1)+' class="'+d+'">'}function Y(a){var d="";i(O(a),function(a,b){d+=a+":"+b+";"});return d}function I(a,d,e,b){function u(a){for(var a=a.split("/"),d=[],e=0,b=a.length;e0&&d.pop():c!==""&&c!="."&&d.push(c)}return"/"+d.join("/")}function k(d,e){if(a.substr(0,d.length)===d){for(var c=[],u= 0;u0&&(u+="/"+c.join("/"));b=="/"&&(u+="/");return u+a.substr(d.length)}else if(h=/^(.*)\//.exec(d))return k(h[1],++e)}d=p(d,"").toLowerCase();a.substr(0,5)!="data:"&&(a=a.replace(/([^:])\/\//g,"$1/"));if(f(d,["absolute","relative","domain"])<0)return a;e=e||location.protocol+"//"+location.host;if(b===c)var t=location.pathname.match(/^(\/.*)\//),b=t?t[1]:"";var h;if(h=/^(\w+:\/\/[^\/]*)/.exec(a)){if(h[1]!==e)return a}else if(/^\w+:/.test(a))return a;/^\//.test(a)? a=e+u(a.substr(1)):/^\w+:\/\//.test(a)||(a=e+u(b+"/"+a));d==="relative"?a=k(e+b,0).substr(2):d==="absolute"&&a.substr(0,e.length)===e&&(a=a.substr(e.length));return a}function M(a,d,e,b,c){var e=e||"",b=p(b,!1),c=p(c,"\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,d,e,b){return d+e.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,"©"),t={};d&&(i(d,function(a,d){for(var e=a.split(","),b=0,c=e.length;b]*)>)([\s\S]*?)(<\/script>)/ig,"")),t.style||(a=a.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/ig,"")));var h=[],a=a.replace(/([ \t\n\r]*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>([ \t\n\r]*)/g,function(a, g,m,o,j,l,q){var g=g||"",m=m||"",n=o.toLowerCase(),s=j||"",o=l?" "+l:"",q=q||"";if(d&&!t[n])return"";o===""&&eb[n]&&(o=" /");fb[n]&&(g&&(g=" "),q&&(q=" "));Ia[n]&&(m?q="\n":g="\n");b&&n=="br"&&(q="\n");if(gb[n]&&!Ia[n])if(b){m&&h.length>0&&h[h.length-1]===n?h.pop():h.push(n);q=g="\n";j=0;for(l=m?h.length:h.length-1;j=0&&(r[a]=I(b,e));(d&&a!=="style"&&!t[n]["*"]&&!t[n][a]||n==="body"&&a==="contenteditable"||/^kindeditor_\d+$/.test(a))&&delete r[a];if(a==="style"&&b!==""){var c=O(b);i(c,function(a){d&&!t[n].style&&!t[n]["."+a]&&delete c[a]});var K= "";i(c,function(a,d){K+=a+":"+d+";"});r.style=K}});s="";i(r,function(a,d){a==="style"&&d===""||(d=d.replace(/"/g,"""),s+=" "+a+'="'+d+'"')})}n==="font"&&(n="span");return g+"<"+m+n+s+o+">"+q}),a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig,function(a,d,e,b){return d+e.replace(/\n/g,'\n')+b}),a=a.replace(/\n\s*\n/g,"\n"),a=a.replace(/\n/g,"\n");return n(a)}function V(a,d){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 M(a,d)}function T(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 hb(a){return H(unescape(a))}function Ja(a){var d="0&&(t+="width:"+e+"px;");b>0&&(t+="height:"+b+"px;");e=/realaudio/i.test(c)?"ke-rm":/flash/i.test(c)?"ke-flash":"ke-media";e='';return e}function Aa(a,d){if(a.nodeType==9&&d.nodeType!=9)return!0;for(;d= d.parentNode;)if(d==a)return!0;return!1}function Ba(a,d){var d=d.toLowerCase(),e=null;if(!Kb&&a.nodeName.toLowerCase()!="script"){var b=a.ownerDocument.createElement("div");b.appendChild(a.cloneNode(!1));b=H(s(b.innerHTML));d in b&&(e=b[d])}else try{e=a.getAttribute(d,2)}catch(c){e=a.getAttribute(d,1)}d==="style"&&e!==null&&(e=Y(e));return e}function Ca(a,d){function e(a){if(typeof a!="string")return a;return a.replace(/([^\w\-])/g,"\\$1")}function b(a,d){return a==="*"||a.toLowerCase()===e(d.toLowerCase())} function c(a,d,e){var u=[];(a=(e.ownerDocument||e).getElementById(a.replace(/\\/g,"")))&&b(d,a.nodeName)&&Aa(e,a)&&u.push(a);return u}function k(a,d,e){var c=e.ownerDocument||e,u=[],k,h,t;if(e.getElementsByClassName){c=e.getElementsByClassName(a.replace(/\\/g,""));k=0;for(h=c.length;k-1&&u.push(t)}return u}function t(a,d,b,c){for(var K=[],b=c.getElementsByTagName(b),u=0,k=b.length;u])+)/.exec(a))?f[1]:"*";if(f=/#((?:[\w\-]|\\.)+)$/.exec(a))e=c(f[1],g,d);else if(f=/\.((?:[\w\-]|\\.)+)$/.exec(a))e=k(f[1],g,d);else if(f=/\[((?:[\w\-]|\\.)+)\]/.exec(a))e= t(f[1].toLowerCase(),null,g,d);else if(f=/\[((?:[\w\-]|\\.)+)\s*=\s*['"]?((?:\\.|[^'"]+)+)['"]?\]/.exec(a)){e=f[1].toLowerCase();f=f[2];if(e==="id")g=c(f,g,d);else if(e==="class")g=k(f,g,d);else if(e==="name"){e=[];f=(d.ownerDocument||d).getElementsByName(f.replace(/\\/g,""));for(var X,i=0,o=f.length;i1){var m=[];i(g,function(){i(Ca(this,d),function(){f(this,m)<0&&m.push(this)})});return m}for(var d=d||document,g=[],o,j=/((?:\\.|[^\s>])+|[\s>])/g;o=j.exec(a);)o[1]!==" "&&g.push(o[1]);o=[];if(g.length==1)return h(g[0],d);var j=!1,n,q,l,r,s,A,p,v,U,z;A=0;for(lenth=g.length;A")j=!0;else{if(A>0){q=[];p=0;for(U=o.length;p