/* KindEditor 4.1.7 (2013-04-21), Copyright (C) kindsoft.net, Licence: http://www.kindsoft.net/license.php */(function(b,d){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 e(a,c){for(var f=0,b=c.length;f=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 s(a){return a.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function t(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 q(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,f={},b=g(a)?a:a.split(c),u;h(b,function(a,c){if(u=/^(\d+)\.\.(\d+)$/.exec(c))for(var b=parseInt(u[1],10);b<=parseInt(u[2],10);b++)f[b.toString()]=!0;else f[c]=!0});return f}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,f){f||(f=c,c=null);var b;if(c){var d=function(){};d.prototype=c.prototype;b=new d;h(f,function(a,c){b[a]=c})}else b=f;b.constructor=a;a.prototype=b;a.parent=c?c.prototype:null}function w(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 H(a,c,f){a.addEventListener?a.addEventListener(c,f,db):a.attachEvent&&a.attachEvent("on"+c,f)}function v(a,c,f){a.removeEventListener?a.removeEventListener(c,f,db):a.detachEvent&&a.detachEvent("on"+c,f)}function E(a,c){this.init(a,c)}function U(a){try{delete a[la]}catch(c){a.removeAttribute&& a.removeAttribute(la)}}function F(a,c,f){if(c.indexOf(",")>=0)h(c.split(","),function(){F(a,this,f)});else{var b=a[la]||null;b||(a[la]=++eb,b=eb);L[b]===d&&(L[b]={});var u=L[b][c];u&&u.length>0?v(a,c,u[0]):(L[b][c]=[],L[b].el=a);u=L[b][c];u.length===0&&(u[0]=function(c){var f=c?new E(a,c):d;h(u,function(c,b){c>0&&b&&b.call(a,f)})});e(f,u)<0&&u.push(f);H(a,c,u[0])}}function N(a,c,f){if(c&&c.indexOf(",")>=0)h(c.split(","),function(){N(a,this,f)});else{var b=a[la]||null;if(b)if(c===d)b in L&&(h(L[b], function(c,f){c!="el"&&f.length>0&&v(a,c,f[0])}),delete L[b],U(a));else if(L[b]){var u=L[b][c];if(u&&u.length>0){f===d?(v(a,c,u[0]),delete L[b][c]):(h(u,function(a,c){a>0&&c===f&&u.splice(a,1)}),u.length==1&&(v(a,c,u[0]),delete L[b][c]));var k=0;h(L[b],function(){k++});k<2&&(delete L[b],U(a))}}}}function ea(a,c){if(c.indexOf(",")>=0)h(c.split(","),function(){ea(a,this)});else{var f=a[la]||null;if(f){var b=L[f][c];if(L[f]&&b&&b.length>0)b[0]()}}}function V(a,c,f){c=/^\d{2,}$/.test(c)?c:c.toUpperCase().charCodeAt(0); F(a,"keydown",function(b){b.ctrlKey&&b.which==c&&!b.shiftKey&&!b.altKey&&(f.call(a),b.stop())})}function Q(a){for(var c={},f=/\s*([\w\-]+)\s*:([^;]*)(;|$)/g,b;b=f.exec(a);){var d=m(b[1].toLowerCase());b=m(q(b[2]));c[d]=b}return c}function G(a){for(var c={},f=/\s+(?:([\w\-:]+)|(?:([\w\-:]+)=([^\s"'<>]+))|(?:([\w\-:"]+)="([^"]*)")|(?:([\w\-:"]+)='([^']*)'))(?=(?:\s|\/|>)+)/g,b;b=f.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 S(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 Y(a){var c="";h(Q(a),function(a,b){c+=a+":"+b+";"});return c}function M(a,c,f,b){function u(a){for(var a=a.split("/"),c=[],f=0,b=a.length;f0&&c.pop():d!==""&&d!="."&&c.push(d)}return"/"+c.join("/")}function k(c,f){if(a.substr(0,c.length)===c){for(var d=[],u= 0;u0&&(u+="/"+d.join("/"));b=="/"&&(u+="/");return u+a.substr(c.length)}else if(i=/^(.*)\//.exec(c))return k(i[1],++f)}c=r(c,"").toLowerCase();a.substr(0,5)!="data:"&&(a=a.replace(/([^:])\/\//g,"$1/"));if(e(c,["absolute","relative","domain"])<0)return a;f=f||location.protocol+"//"+location.host;if(b===d)var B=location.pathname.match(/^(\/.*)\//),b=B?B[1]:"";var i;if(i=/^(\w+:\/\/[^\/]*)/.exec(a)){if(i[1]!==f)return a}else if(/^\w+:/.test(a))return a;/^\//.test(a)? a=f+u(a.substr(1)):/^\w+:\/\//.test(a)||(a=f+u(b+"/"+a));c==="relative"?a=k(f+b,0).substr(2):c==="absolute"&&a.substr(0,f.length)===f&&(a=a.substr(f.length));return a}function J(a,c,f,b,d){var f=f||"",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,f,b){return c+f.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,"©"),B={};c&&(h(c,function(a,c){for(var f=a.split(","),b=0,d=f.length;b]*)>)([\s\S]*?)(<\/script>)/ig,"")),B.style||(a=a.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/ig,"")));var i=[],a=a.replace(/([ \t\n\r]*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>([ \t\n\r]*)/g,function(a, g,j,n,o,s,l){var g=g||"",j=j||"",m=n.toLowerCase(),q=o||"",n=s?" "+s:"",l=l||"";if(c&&!B[m])return"";n===""&&fb[m]&&(n=" /");gb[m]&&(g&&(g=" "),l&&(l=" "));Ja[m]&&(j?l="\n":g="\n");b&&m=="br"&&(l="\n");if(hb[m]&&!Ja[m])if(b){j&&i.length>0&&i[i.length-1]===m?i.pop():i.push(m);l=g="\n";o=0;for(s=j?i.length:i.length-1;o=0&&(t[a]=M(b,f));(c&&a!=="style"&&!B[m]["*"]&&!B[m][a]||m==="body"&&a==="contenteditable"||/^kindeditor_\d+$/.test(a))&&delete t[a];if(a==="style"&&b!==""){var d=Q(b);h(d,function(a){c&&!B[m].style&&!B[m]["."+a]&&delete d[a]});var K= "";h(d,function(a,c){K+=a+":"+c+";"});t.style=K}});q="";h(t,function(a,c){a==="style"&&c===""||(c=c.replace(/"/g,"""),q+=" "+a+'="'+c+'"')})}m==="font"&&(m="span");return g+"<"+j+m+q+n+">"+l}),a=a.replace(/(<(?:pre|pre\s[^>]*)>)([\s\S]*?)(<\/pre>)/ig,function(a,c,f,b){return c+f.replace(/\n/g,'\n')+b}),a=a.replace(/\n\s*\n/g,"\n"),a=a.replace(/\n/g,"\n");return m(a)}function W(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 J(a,c)}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 fa(a){return G(unescape(a))}function Ka(a){var c="0&&(i+="width:"+f+"px;");b>0&&(i+="height:"+b+"px;");f=/realaudio/i.test(d)?"ke-rm":/flash/i.test(d)?"ke-flash":"ke-media";f='';return f}function Ba(a,c){if(a.nodeType==9&&c.nodeType!=9)return!0;for(;c= c.parentNode;)if(c==a)return!0;return!1}function Ca(a,c){var c=c.toLowerCase(),f=null;if(!Kb&&a.nodeName.toLowerCase()!="script"){var b=a.ownerDocument.createElement("div");b.appendChild(a.cloneNode(!1));b=G(t(b.innerHTML));c in b&&(f=b[c])}else try{f=a.getAttribute(c,2)}catch(d){f=a.getAttribute(c,1)}c==="style"&&f!==null&&(f=Y(f));return f}function Da(a,c){function f(a){if(typeof a!="string")return a;return a.replace(/([^\w\-])/g,"\\$1")}function b(a,c){return a==="*"||a.toLowerCase()===f(c.toLowerCase())} function d(a,c,f){var u=[];(a=(f.ownerDocument||f).getElementById(a.replace(/\\/g,"")))&&b(c,a.nodeName)&&Ba(f,a)&&u.push(a);return u}function k(a,c,f){var d=f.ownerDocument||f,u=[],k,i,B;if(f.getElementsByClassName){d=f.getElementsByClassName(a.replace(/\\/g,""));k=0;for(i=d.length;k-1&&u.push(B)}return u}function i(a,c,b,d){for(var K=[],b=d.getElementsByTagName(b),u=0,k=b.length;u])+)/.exec(a))?e[1]:"*";if(e=/#((?:[\w\-]|\\.)+)$/.exec(a))f=d(e[1],P,c);else if(e=/\.((?:[\w\-]|\\.)+)$/.exec(a))f=k(e[1],P,c);else if(e=/\[((?:[\w\-]|\\.)+)\]/.exec(a))f= i(e[1].toLowerCase(),null,P,c);else if(e=/\[((?:[\w\-]|\\.)+)\s*=\s*['"]?((?:\\.|[^'"]+)+)['"]?\]/.exec(a)){f=e[1].toLowerCase();e=e[2];if(f==="id")P=d(e,P,c);else if(f==="class")P=k(e,P,c);else if(f==="name"){f=[];e=(c.ownerDocument||c).getElementsByName(e.replace(/\\/g,""));for(var h,j=0,o=e.length;j1){var n=[];h(j,function(){h(Da(this,c),function(){e(this,n)<0&&n.push(this)})});return n}for(var c=c||document,j=[],o,m=/((?:\\.|[^\s>])+|[\s>])/g;o=m.exec(a);)o[1]!==" "&&j.push(o[1]);o=[];if(j.length==1)return g(j[0],c);var m=!1,l,s,q,t,w,p,r,N,F,v;p=0;for(lenth=j.length;p")m=!0;else{if(p>0){s=[];r=0;for(F=o.length;r