/* KindEditor 4.1.7 (2013-04-21), Copyright (C) kindsoft.net, Licence: http://www.kindsoft.net/license.php */(function(A,o){function Y(a){if(!a)return!1;return Object.prototype.toString.call(a)==="[object Array]"}function bb(a){if(!a)return!1;return Object.prototype.toString.call(a)==="[object Function]"}function N(a,b){for(var c=0,d=b.length;c=0}function s(a,b){b=b||"px";return a&&/^\d+$/.test(a)?a+b:a}function t(a){var b;return a&&(b=/(\d+)/.exec(a))?parseInt(b[1],10):0}function C(a){return a.replace(/&/g,"&").replace(//g,">").replace(/"/g,""")}function fa(a){return a.replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/&/g,"&")}function ga(a){var b=a.split("-"),a="";m(b,function(b,d){a+=b>0?d.charAt(0).toUpperCase()+ d.substr(1):d});return a}function va(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,g){return"#"+b(d)+b(e)+b(g)})}function u(a,b){var b=b===o?",":b,c={},d=Y(a)?a:a.split(b),e;m(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 Fa(a,b){return Array.prototype.slice.call(a,b||0)} function j(a,b){return a===o?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;m(c,function(a,b){d[a]=b})}else d=c;d.constructor=a;a.prototype=d;a.parent=b?b.prototype:null}function cb(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 Pb(a,b,c){a.addEventListener?a.addEventListener(b,c,db):a.attachEvent&&a.attachEvent("on"+b,c)}function wa(a,b,c){a.removeEventListener?a.removeEventListener(b,c,db):a.detachEvent&&a.detachEvent("on"+b,c)}function eb(a,b){this.init(a,b)}function fb(a){try{delete a[Z]}catch(b){a.removeAttribute&& a.removeAttribute(Z)}}function $(a,b,c){if(b.indexOf(",")>=0)m(b.split(","),function(){$(a,this,c)});else{var d=a[Z]||null;d||(a[Z]=++gb,d=gb);v[d]===o&&(v[d]={});var e=v[d][b];e&&e.length>0?wa(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 eb(a,b):o;m(e,function(b,d){b>0&&d&&d.call(a,c)})});N(c,e)<0&&e.push(c);Pb(a,b,e[0])}}function ha(a,b,c){if(b&&b.indexOf(",")>=0)m(b.split(","),function(){ha(a,this,c)});else{var d=a[Z]||null;if(d)if(b===o)d in v&&(m(v[d], function(b,c){b!="el"&&c.length>0&&wa(a,b,c[0])}),delete v[d],fb(a));else if(v[d]){var e=v[d][b];if(e&&e.length>0){c===o?(wa(a,b,e[0]),delete v[d][b]):(m(e,function(a,b){a>0&&b===c&&e.splice(a,1)}),e.length==1&&(wa(a,b,e[0]),delete v[d][b]));var g=0;m(v[d],function(){g++});g<2&&(delete v[d],fb(a))}}}}function hb(a,b){if(b.indexOf(",")>=0)m(b.split(","),function(){hb(a,this)});else{var c=a[Z]||null;if(c){var d=v[c][b];if(v[c]&&d&&d.length>0)d[0]()}}}function Ga(a,b,c){b=/^\d{2,}$/.test(b)?b:b.toUpperCase().charCodeAt(0); $(a,"keydown",function(d){d.ctrlKey&&d.which==b&&!d.shiftKey&&!d.altKey&&(c.call(a),d.stop())})}function aa(a){for(var b={},c=/\s*([\w\-]+)\s*:([^;]*)(;|$)/g,d;d=c.exec(a);){var e=B(d[1].toLowerCase());d=B(va(d[2]));b[e]=d}return b}function H(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 Qb(a,b){return a= /\s+class\s*=/.test(a)?a.replace(/(\s+class=["']?)([^"']*)(["']?[\s>])/,function(a,d,e,g){return(" "+e+" ").indexOf(" "+b+" ")<0?e===""?d+b+g:d+e+" "+b+g:a}):a.substr(0,a.length-1)+' class="'+b+'">'}function Rb(a){var b="";m(aa(a),function(a,d){b+=a+":"+d+";"});return b}function ia(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 g(b,c){if(a.substr(0,b.length)===b){for(var e=[], h=0;h0&&(h+="/"+e.join("/"));d=="/"&&(h+="/");return h+a.substr(b.length)}else if(f=/^(.*)\//.exec(b))return g(f[1],++c)}b=j(b,"").toLowerCase();a.substr(0,5)!="data:"&&(a=a.replace(/([^:])\/\//g,"$1/"));if(N(b,["absolute","relative","domain"])<0)return a;c=c||location.protocol+"//"+location.host;if(d===o)var h=location.pathname.match(/^(\/.*)\//),d=h?h[1]:"";var f;if(f=/^(\w+:\/\/[^\/]*)/.exec(a)){if(f[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=g(c+d,0).substr(2):b==="absolute"&&a.substr(0,c.length)===c&&(a=a.substr(c.length));return a}function S(a,b,c,d,e){var c=c||"",d=j(d,!1),e=j(e,"\t"),g="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,""),a=a.replace(/\u00A9/g,"©"),h={};b&&(m(b,function(a,b){for(var c=a.split(","),d=0,e=c.length;d]*)>)([\s\S]*?)(<\/script>)/ig,"")),h.style||(a=a.replace(/(<(?:style|style\s[^>]*)>)([\s\S]*?)(<\/style>)/ig,"")));var f=[],a=a.replace(/([ \t\n\r]*)<(\/)?([\w\-:]+)((?:\s+|(?:\s+[\w\-:]+)|(?:\s+[\w\-:]+=[^\s"'<>]+)|(?:\s+[\w\-:"]+="[^"]*")|(?:\s+[\w\-:"]+='[^']*'))*)(\/)?>([ \t\n\r]*)/g,function(a, n,r,p,I,o,j){var n=n||"",r=r||"",l=p.toLowerCase(),J=I||"",p=o?" "+o:"",j=j||"";if(b&&!h[l])return"";p===""&&ib[l]&&(p=" /");jb[l]&&(n&&(n=" "),j&&(j=" "));Ha[l]&&(r?j="\n":n="\n");d&&l=="br"&&(j="\n");if(kb[l]&&!Ha[l])if(d){r&&f.length>0&&f[f.length-1]===l?f.pop():f.push(l);j=n="\n";I=0;for(o=r?f.length:f.length-1;I=0&&(w[a]=ia(d,c));(b&&a!=="style"&&!h[l]["*"]&&!h[l][a]||l==="body"&&a==="contenteditable"||/^kindeditor_\d+$/.test(a))&&delete w[a];if(a==="style"&&d!==""){var e=aa(d);m(e,function(a){b&&!h[l].style&&!h[l]["."+a]&&delete e[a]});var g= "";m(e,function(a,b){g+=a+":"+b+";"});w.style=g}});J="";m(w,function(a,b){a==="style"&&b===""||(b=b.replace(/"/g,"""),J+=" "+a+'="'+b+'"')})}l==="font"&&(l="span");return n+"<"+r+l+J+p+">"+j}),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 B(a)}function lb(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 S(a,b)}function mb(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 nb(a){return H(unescape(a))}function Ia(a){var b="0&&(h+="width:"+c+"px;");d>0&&(h+="height:"+d+"px;");c=/realaudio/i.test(e)?"ke-rm":/flash/i.test(e)?"ke-flash":"ke-media";c='';return c}function xa(a,b){if(a.nodeType==9&&b.nodeType!=9)return!0;for(;b= b.parentNode;)if(b==a)return!0;return!1}function ya(a,b){var b=b.toLowerCase(),c=null;if(!Tb&&a.nodeName.toLowerCase()!="script"){var d=a.ownerDocument.createElement("div");d.appendChild(a.cloneNode(!1));d=H(fa(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=Rb(c));return c}function za(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)&&xa(c,a)&&e.push(a);return e}function g(a,b,c){var e=c.ownerDocument||c,g=[],h,f,i;if(c.getElementsByClassName){e=c.getElementsByClassName(a.replace(/\\/g,""));h=0;for(f=e.length;h-1&&g.push(i)}return g}function h(a,b,d,e){for(var g=[],d=e.getElementsByTagName(d),h=0,f=d.length;h])+)/.exec(a))?i[1]:"*";if(i=/#((?:[\w\-]|\\.)+)$/.exec(a))c=e(i[1],k,b);else if(i=/\.((?:[\w\-]|\\.)+)$/.exec(a))c=g(i[1],k,b);else if(i=/\[((?:[\w\-]|\\.)+)\]/.exec(a))c= h(i[1].toLowerCase(),null,k,b);else if(i=/\[((?:[\w\-]|\\.)+)\s*=\s*['"]?((?:\\.|[^'"]+)+)['"]?\]/.exec(a)){c=i[1].toLowerCase();i=i[2];if(c==="id")k=e(i,k,b);else if(c==="class")k=g(i,k,b);else if(c==="name"){c=[];i=(b.ownerDocument||b).getElementsByName(i.replace(/\\/g,""));for(var n,p=0,r=i.length;p1){var n=[];m(k,function(){m(za(this,b),function(){N(this,n)<0&&n.push(this)})});return n}for(var b=b||document,k=[],r,p=/((?:\\.|[^\s>])+|[\s>])/g;r=p.exec(a);)r[1]!==" "&&k.push(r[1]);r=[];if(k.length==1)return f(k[0],b);var p=!1,I,l,j,o,J,w,K,F,q,s;w=0;for(lenth=k.length;w")p=!0;else{if(w>0){l=[];K=0;for(q=r.length;K