/* KindEditor 4.0.5 (2012-01-15), Copyright (C) kindsoft.net, Licence: http://www.kindsoft.net/license.php */(function(B,n){function da(a){if(!a)return!1;return Object.prototype.toString.call(a)==="[object Array]"}function Za(a){if(!a)return!1;return Object.prototype.toString.call(a)==="[object Function]"}function M(a,b){for(var c=0,d=b.length;c=0}function s(a){return a&&/^\d+$/.test(a)?a+"px":a}function t(a){var b;return a&&(b=/(\d+)/.exec(a))?parseInt(b[1],10):0}function D(a){return a.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function $a(a){return a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function ea(a){var b=a.split("-"),a="";l(b,function(b,d){a+=b>0?d.charAt(0).toUpperCase()+d.substr(1): d});return a}function na(a){function b(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,d,e,f){return"#"+b(d)+b(e)+b(f)})}function u(a,b){var b=b===n?",":b,c={},d=da(a)?a:a.split(b),e;l(d,function(a,b){if(e=/^(\d+)\.\.(\d+)$/.exec(b))for(var d=parseInt(e[1],10);d<=parseInt(e[2],10);d++)c[d.toString()]=!0;else c[b]=!0});return c}function Da(a,b){return Array.prototype.slice.call(a,b||0)}function k(a, b){return a===n?b:a}function E(a,b,c){c||(c=b,b=null);var d;if(b){var e=function(){};e.prototype=b.prototype;d=new e;l(c,function(a,b){d[a]=b})}else d=c;d.constructor=a;a.prototype=d;a.parent=b?b.prototype:null}function ab(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;b.test(a)&&(a=a.replace(b,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 Mb(a,b,c){a.addEventListener?a.addEventListener(b,c,bb):a.attachEvent&&a.attachEvent("on"+b,c)}function oa(a,b,c){a.removeEventListener?a.removeEventListener(b,c,bb):a.detachEvent&&a.detachEvent("on"+b,c)}function cb(a,b){this.init(a,b)}function db(a){try{delete a[V]}catch(b){a.removeAttribute&& a.removeAttribute(V)}}function W(a,b,c){if(b.indexOf(",")>=0)l(b.split(","),function(){W(a,this,c)});else{var d=a[V]||null;d||(a[V]=++eb,d=eb);v[d]===n&&(v[d]={});var e=v[d][b];e&&e.length>0?oa(a,b,e[0]):(v[d][b]=[],v[d].el=a);e=v[d][b];e.length===0&&(e[0]=function(b){var c=b?new cb(a,b):n;l(e,function(b,d){b>0&&d&&d.call(a,c)})});M(c,e)<0&&e.push(c);Mb(a,b,e[0])}}function fa(a,b,c){if(b&&b.indexOf(",")>=0)l(b.split(","),function(){fa(a,this,c)});else{var d=a[V]||null;if(d)if(b===n)d in v&&(l(v[d], function(b,c){b!="el"&&c.length>0&&oa(a,b,c[0])}),delete v[d],db(a));else if(v[d]){var e=v[d][b];if(e&&e.length>0){c===n?(oa(a,b,e[0]),delete v[d][b]):(l(e,function(a,b){a>0&&b===c&&e.splice(a,1)}),e.length==1&&(oa(a,b,e[0]),delete v[d][b]));var f=0;l(v[d],function(){f++});f<2&&(delete v[d],db(a))}}}}function fb(a,b){if(b.indexOf(",")>=0)l(b.split(","),function(){fb(a,this)});else{var c=a[V]||null;if(c){var d=v[c][b];if(v[c]&&d&&d.length>0)d[0]()}}}function Ea(a,b,c){b=/^\d{2,}$/.test(b)?b:b.toUpperCase().charCodeAt(0); W(a,"keydown",function(d){d.ctrlKey&&d.which==b&&!d.shiftKey&&!d.altKey&&(c.call(a),d.stop())})}function ga(a){for(var b={},c=/\s*([\w\-]+)\s*:([^;]*)(;|$)/g,d;d=c.exec(a);){var e=C(d[1].toLowerCase());d=C(na(d[2]));b[e]=d}return b}function J(a){for(var b={},c=/\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g,d;d=c.exec(a);){var e=(d[1]||d[2]||d[4]||d[6]).toLowerCase();b[e]=(d[2]?d[3]:d[4]?d[5]:d[7])||""}return b}function Nb(a,b){return a= /\s+class\s*=/.test(a)?a.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/,function(a,d,e,f){return(" "+e+" ").indexOf(" "+b+" ")<0?e===""?d+b+f:d+e+" "+b+f:a}):a.substr(0,a.length-1)+' class="'+b+'">'}function Ob(a){var b="";l(ga(a),function(a,d){b+=a+":"+d+";"});return b}function pa(a,b,c,d){function e(a){for(var a=a.split("/"),b=[],c=0,d=a.length;c0&&b.pop():e!==""&&e!="."&&b.push(e)}return"/"+b.join("/")}function f(b,c){if(a.substr(0,b.length)===b){for(var e=[], g=0;g0&&(g+="/"+e.join("/"));d=="/"&&(g+="/");return g+a.substr(b.length)}else if(h=/^(.*)\//.exec(b))return f(h[1],++c)}b=k(b,"").toLowerCase();if(M(b,["absolute","relative","domain"])<0)return a;c=c||location.protocol+"//"+location.host;if(d===n)var g=location.pathname.match(/^(\/.*)\//),d=g?g[1]:"";var h;if(h=/^(\w+:\/\/[^\/]*)/.exec(a)){if(h[1]!==c)return a}else if(/^\w+:/.test(a))return a;/^\//.test(a)?a=c+e(a.substr(1)):/^\w+:\/\//.test(a)||(a=c+e(d+"/"+a)); b==="relative"?a=f(c+d,0).substr(2):b==="absolute"&&a.substr(0,c.length)===c&&(a=a.substr(c.length));return a}function R(a,b,c,d,e){var c=c||"",d=k(d,!1),e=k(e,"\t"),f="xx-small,x-small,small,medium,large,x-large,xx-large".split(","),a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig,function(a,b,c,d){return b+c.replace(/<(?:br|br\s[^>]*)>/ig,"\n")+d}),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,""), g={};b&&(l(b,function(a,b){for(var c=a.split(","),d=0,e=c.length;d]*)>)([\s\S]*?)(<\/script>)/ig,"")),g.style||(a=a.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/ig,"")));var h=[],a=a.replace(/(\s*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>(\s*)/g,function(a,m,o,A,K,r,q){var m=m||"",o=o||"",w=A.toLowerCase(),n=K||"",A=r?" "+r:"",q=q||""; if(b&&!g[w])return"";A===""&&gb[w]&&(A=" /");hb[w]&&(m&&(m=" "),q&&(q=" "));Fa[w]&&(o?q="\n":m="\n");d&&w=="br"&&(q="\n");if(ib[w]&&!Fa[w])if(d){o&&h.length>0&&h[h.length-1]===w?h.pop():h.push(w);q=m="\n";K=0;for(r=o?h.length:h.length-1;K=0&&(k[a]=pa(d,c));(b&&a!=="style"&&!g[w]["*"]&&!g[w][a]||w==="body"&&a==="contenteditable"||/^kindeditor_\d+$/.test(a))&&delete k[a];if(a==="style"&&d!==""){var e=ga(d);l(e,function(a){b&&!g[w].style&&!g[w]["."+a]&&delete e[a]});var f="";l(e,function(a,b){f+=a+":"+b+";"});k.style=f}});n="";l(k,function(a,b){a==="style"&& b===""||(b=b.replace(/"/g,"""),n+=" "+a+'="'+b+'"')})}w==="font"&&(w="span");return m+"<"+o+w+n+A+">"+q}),a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig,function(a,b,c,d){return b+c.replace(/\n/g,'\n')+d}),a=a.replace(/\n\s*\n/g,"\n"),a=a.replace(/\n/g,"\n");return C(a)}function jb(a,b){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 R(a,b)}function kb(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 lb(a){return J(unescape(a))}function Ga(a){var b="0&&(g+="width:"+c+"px;");d>0&&(g+="height:"+d+"px;");c=/realaudio/i.test(e)?"ke-rm":/flash/i.test(e)?"ke-flash":"ke-media";c='';return c}function ra(a,b){if(a.nodeType==9&&b.nodeType!=9)return!0;for(;b=b.parentNode;)if(b==a)return!0;return!1}function sa(a,b){var b=b.toLowerCase(), c=null;if(!Qb&&a.nodeName.toLowerCase()!="script"){var d=a.ownerDocument.createElement("div");d.appendChild(a.cloneNode(!1));d=J($a(d.innerHTML));b in d&&(c=d[b])}else try{c=a.getAttribute(b,2)}catch(e){c=a.getAttribute(b,1)}b==="style"&&c!==null&&(c=Ob(c));return c}function ta(a,b){function c(a){if(typeof a!="string")return a;return a.replace(/([^\w\-])/g,"\\$1")}function d(a,b){return a==="*"||a.toLowerCase()===c(b.toLowerCase())}function e(a,b,c){var e=[];(a=(c.ownerDocument||c).getElementById(a.replace(/\\/g, "")))&&d(b,a.nodeName)&&ra(c,a)&&e.push(a);return e}function f(a,b,c){var e=c.ownerDocument||c,g=[],j,i,h;if(c.getElementsByClassName){e=c.getElementsByClassName(a.replace(/\\/g,""));j=0;for(i=e.length;j-1&&g.push(h)}return g}function g(a,b,d,e){for(var f=[],d=e.getElementsByTagName(d),g=0,j=d.length;g])+)/.exec(a))?j[1]:"*";if(j=/#((?:[\w\-]|\\.)+)$/.exec(a))c=e(j[1],h,b);else if(j=/\.((?:[\w\-]|\\.)+)$/.exec(a))c=f(j[1],h,b);else if(j=/\[((?:[\w\-]|\\.)+)\]/.exec(a))c=g(j[1].toLowerCase(),null,h,b);else if(j=/\[((?:[\w\-]|\\.)+)\s*=\s*['"]?((?:\\.|[^'"]+)+)['"]?\]/.exec(a)){c= j[1].toLowerCase();j=j[2];if(c==="id")h=e(j,h,b);else if(c==="class")h=f(j,h,b);else if(c==="name"){c=[];j=(b.ownerDocument||b).getElementsByName(j.replace(/\\/g,""));for(var m,o=0,q=j.length;o1){var m=[];l(j,function(){l(ta(this,b),function(){M(this,m)<0&&m.push(this)})}); return m}for(var b=b||document,j=[],o,A=/((?:\\.|[^\s>])+|[\s>])/g;o=A.exec(a);)o[1]!==" "&&j.push(o[1]);o=[];if(j.length==1)return h(j[0],b);var A=!1,K,r,q,k,n,p,qa,G,s,t;p=0;for(lenth=j.length;p")A=!0;else{if(p>0){r=[];qa=0;for(s=o.length;qa