UEDITOR_CONFIG=window.UEDITOR_CONFIG||{};var baidu=window.baidu||{};window.baidu=baidu;window.UE=baidu.editor={};UE.plugins={};UE.commands={};UE.instants={};UE.I18N={};UE.version="1.2.5.0";var dom=UE.dom={};var browser=UE.browser=function(){var d=navigator.userAgent.toLowerCase(),b=window.opera,c={ie:!!window.ActiveXObject,opera:(!!b&&b.version),webkit:(d.indexOf(" applewebkit/")>-1),mac:(d.indexOf("macintosh")>-1),quirks:(document.compatMode=="BackCompat")};c.gecko=(navigator.product=="Gecko"&&!c.webkit&&!c.opera);var a=0;if(c.ie){a=parseFloat(d.match(/msie (\d+)/)[1]);c.ie9Compat=document.documentMode==9;c.ie8=!!document.documentMode;c.ie8Compat=document.documentMode==8;c.ie7Compat=((a==7&&!document.documentMode)||document.documentMode==7);c.ie6Compat=(a<7||c.quirks)}if(c.gecko){var e=d.match(/rv:([\d\.]+)/);if(e){e=e[1].split(".");a=e[0]*10000+(e[1]||0)*100+(e[2]||0)*1}}if(/chrome\/(\d+\.\d)/i.test(d)){c.chrome=+RegExp["\x241"]}if(/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(d)&&!/chrome/i.test(d)){c.safari=+(RegExp["\x241"]||RegExp["\x242"])}if(c.opera){a=parseFloat(b.version())}if(c.webkit){a=parseFloat(d.match(/ applewebkit\/(\d+)/)[1])}c.version=a;c.isCompatible=!c.mobile&&((c.ie&&a>=6)||(c.gecko&&a>=10801)||(c.opera&&a>=9.5)||(c.air&&a>=1)||(c.webkit&&a>=522)||false);return c}();var ie=browser.ie,webkit=browser.webkit,gecko=browser.gecko,opera=browser.opera;var utils=UE.utils={each:function(f,e,d){if(f==null){return}if(f.length===+f.length){for(var c=0,a=f.length;c=c&&e===b){a=f;return false}});return a},removeItem:function(d,c){for(var b=0,a=d.length;b]/g,function(c){return{"<":"<","&":"&",'"':""",">":">"}[c]}):""},html:function(a){return a?a.replace(/&((g|l|quo)t|amp);/g,function(b){return{"<":"<","&":"&",""":'"',">":">"}[b]}):""},cssStyleToDomStyle:function(){var b=document.createElement("div").style,a={"float":b.cssFloat!=undefined?"cssFloat":b.styleFloat!=undefined?"styleFloat":"float"};return function(c){return a[c]||(a[c]=c.toLowerCase().replace(/-./g,function(d){return d.charAt(1).toUpperCase()}))}}(),loadFile:function(){var a=[];function b(h,g){try{for(var d=0,c;c=a[d++];){if(c.doc===h&&c.url==(g.src||g.href)){return c}}}catch(f){return null}}return function(i,h,e){var f=b(i,h);if(f){if(f.ready){e&&e()}else{f.funs.push(e)}return}a.push({doc:i,url:h.src||h.href,funs:[e]});if(!i.body){var d=[];for(var g in h){if(g=="tag"){continue}d.push(g+'="'+h[g]+'"')}i.write("<"+h.tag+" "+d.join(" ")+" >");return}if(h.id&&i.getElementById(h.id)){return}var c=i.createElement(h.tag);delete h.tag;for(var g in h){c.setAttribute(g,h[g])}c.onload=c.onreadystatechange=function(){if(!this.readyState||/loaded|complete/.test(this.readyState)){f=b(i,h);if(f.funs.length>0){f.ready=1;for(var j;j=f.funs.pop();){j()}}c.onload=c.onreadystatechange=null}};c.onerror=function(){throw Error("The load "+(h.href||h.src)+" fails,check the url settings of file editor_config.js ")};i.getElementsByTagName("head")[0].appendChild(c)}}(),isEmptyObject:function(b){if(b==null){return true}if(this.isArray(b)||this.isString(b)){return b.length===0}for(var a in b){if(b.hasOwnProperty(a)){return false}}return true},fixColor:function(b,d){if(/color/i.test(b)&&/rgba?/.test(d)){var e=d.split(",");if(e.length>3){return""}d="#";for(var c=0,a;a=e[c++];){a=parseInt(a.replace(/[^\d]/gi,""),10).toString(16);d+=a.length==1?"0"+a:a}d=d.toUpperCase()}return d},optCss:function(e){var d,c,a;e=e.replace(/(padding|margin|border)\-([^:]+):([^;]+);?/gi,function(i,g,f,h){if(h.split(" ").length==1){switch(g){case"padding":!d&&(d={});d[f]=h;return"";case"margin":!c&&(c={});c[f]=h;return"";case"border":return h=="initial"?"":i}}return i});function b(m,h){if(!m){return""}var i=m.top,f=m.bottom,g=m.left,j=m.right,n="";if(!i||!g||!f||!j){for(var k in m){n+=";"+h+"-"+k+":"+m[k]+";"}}else{n+=";"+h+":"+(i==f&&f==g&&g==j?i:i==f&&g==j?(i+" "+g):g==j?(i+" "+g+" "+f):(i+" "+j+" "+f+" "+g))+";"}return n}e+=b(d,"padding")+b(c,"margin");return e.replace(/^[ \n\r\t;]*|[ \n\r\t]*$/,"").replace(/;([ \n\r\t]+)|\1;/g,";").replace(/(&((l|g)t|quot|#39))?;{2,}/g,function(g,f){return f?f+";;":";"})},clone:function(c,d){var b;d=d||{};for(var a in c){if(c.hasOwnProperty(a)){b=c[a];if(typeof b=="object"){d[a]=utils.isArray(b)?[]:{};utils.clone(c[a],d[a])}else{d[a]=b}}}return d},transUnitToPx:function(b){if(!/(pt|cm)/.test(b)){return b}var a;b.replace(/([\d.]+)(\w+)/,function(e,c,d){b=c;a=d});switch(a){case"cm":b=parseFloat(b)*25;break;case"pt":b=Math.round(parseFloat(b)*96/72)}return b+(b?"px":"")},domReady:function(){var a=[];function b(d){d.isReady=true;for(var c;c=a.pop();c()){}}return function(c,e){e=e||window;var d=e.document;c&&a.push(c);if(d.readyState==="complete"){b(d)}else{d.isReady&&b(d);if(browser.ie){(function(){if(d.isReady){return}try{d.documentElement.doScroll("left")}catch(f){setTimeout(arguments.callee,0);return}b(d)})();e.attachEvent("onload",function(){b(d)})}else{d.addEventListener("DOMContentLoaded",function(){d.removeEventListener("DOMContentLoaded",arguments.callee,false);b(d)},false);e.addEventListener("load",function(){b(d)},false)}}}}(),cssRule:browser.ie?function(d,e,f){var a,c;f=f||document;if(f.indexList){a=f.indexList}else{a=f.indexList={}}var b;if(!a[d]){if(e===undefined){return""}b=f.createStyleSheet("",c=f.styleSheets.length);a[d]=c}else{b=f.styleSheets[a[d]]}if(e===undefined){return b.cssText}b.cssText=e||""}:function(b,c,e){e=e||document;var a=e.getElementsByTagName("head")[0],d;if(!(d=e.getElementById(b))){if(c===undefined){return""}d=e.createElement("style");d.id=b;a.appendChild(d)}if(c===undefined){return d.innerHTML}if(c!==""){d.innerHTML=c}else{a.removeChild(d)}}};utils.each(["String","Function","Array","Number","RegExp"],function(a){UE.utils["is"+a]=function(b){return Object.prototype.toString.apply(b)=="[object "+a+"]"}});var EventBase=UE.EventBase=function(){};EventBase.prototype={addListener:function(b,d){b=utils.trim(b).split(" ");for(var a=0,c;c=b[a++];){getListener(this,c,true).push(d)}},removeListener:function(b,d){b=utils.trim(b).split(" ");for(var a=0,c;c=b[a++];){utils.removeItem(getListener(this,c)||[],d)}},fireEvent:function(d){d=utils.trim(d).split(" ");for(var c=0,f;f=d[c++];){var e=getListener(this,f),g,b,a;if(e){a=e.length;while(a--){if(!e[a]){continue}b=e[a].apply(this,arguments);if(b===true){return b}if(b!==undefined){g=b}}}if(b=this["on"+f.toLowerCase()]){g=b.apply(this,arguments)}}return g}};function getListener(d,b,c){var a;b=b.toLowerCase();return((a=(d.__allListeners||c&&(d.__allListeners={})))&&(a[b]||c&&(a[b]=[])))}UE.ajax=function(){var a="XMLHttpRequest()";try{new ActiveXObject("Msxml2.XMLHTTP");a="ActiveXObject('Msxml2.XMLHTTP')"}catch(d){try{new ActiveXObject("Microsoft.XMLHTTP");a="ActiveXObject('Microsoft.XMLHTTP')"}catch(d){}}var c=new Function("return new "+a);function b(f){var g=[];for(var e in f){if(e=="method"||e=="timeout"||e=="async"){continue}if(!((typeof f[e]).toLowerCase()=="function"||(typeof f[e]).toLowerCase()=="object")){g.push(encodeURIComponent(e)+"="+encodeURIComponent(f[e]))}}return g.join("&")}return{request:function(f,h){var l=c(),i=false,g={method:"POST",timeout:5000,async:true,data:{},onsuccess:function(){},onerror:function(){}};if(typeof f==="object"){h=f;f=h.url}if(!l||!f){return}var k=h?utils.extend(g,h):g;var n=b(k);if(!utils.isEmptyObject(k.data)){n+=(n?"&":"")+b(k.data)}var m=setTimeout(function(){if(l.readyState!=4){i=true;l.abort();clearTimeout(m)}},k.timeout);var e=k.method.toUpperCase();var j=f+(f.indexOf("?")==-1?"?":"&")+(e=="POST"?"":n+"&noCache="+ +new Date);l.open(e,j,k.async);l.onreadystatechange=function(){if(l.readyState==4){if(!i&&l.status==200){k.onsuccess(l)}else{k.onerror(l)}}};if(e=="POST"){l.setRequestHeader("Content-Type","application/x-www-form-urlencoded");l.send(n)}else{l.send(null)}}}}();var filterWord=UE.filterWord=function(){function c(d){return/(class="?Mso|style="[^"]*\bmso\-|w:WordDocument|/ig,"").replace(/]*>[\s\S]*?.<\/v:shape>/gi,function(j){if(browser.opera){return""}try{var g=j.match(/width:([ \d.]*p[tx])/i)[1],f=j.match(/height:([ \d.]*p[tx])/i)[1],i=j.match(/src=\s*"([^"]*)"/i)[1];return''}catch(h){return""}}).replace(/<\/?div[^>]*>/g,"").replace(/v:\w+=(["']?)[^'"]+\1/g,"").replace(/<(!|script[^>]*>.*?<\/script(?=[>\s])|\/?(\?xml(:\w+)?|xml|meta|link|style|\w+:\w+)(?=[\s\/>]))[^>]*>/gi,"").replace(/

]*class="?MsoHeading"?[^>]*>(.*?)<\/p>/gi,"

$1

").replace(/\s+(class|lang|align)\s*=\s*(['"]?)[\w-]+\2/ig,"").replace(/<(font|span)[^>]*>\s*<\/\1>/gi,"").replace(/(<[a-z][^>]*)\sstyle=(["'])([^\2]*?)\2/gi,function(l,q,j,f){var g=[],p=f.replace(/^\s+|\s+$/,"").replace(/'/g,"'").replace(/"/gi,"'").split(/;\s*/g);for(var k=0,o;o=p[k];k++){var e,m,h=o.split(":");if(h.length==2){e=h[0].toLowerCase();m=h[1].toLowerCase();if(/^(background)\w*/.test(e)&&m.replace(/(initial|\s)/g,"").length==0||/^(margin)\w*/.test(e)&&/^0\w+$/.test(m)){continue}switch(e){case"mso-padding-alt":case"mso-padding-top-alt":case"mso-padding-right-alt":case"mso-padding-bottom-alt":case"mso-padding-left-alt":case"mso-margin-alt":case"mso-margin-top-alt":case"mso-margin-right-alt":case"mso-margin-bottom-alt":case"mso-margin-left-alt":case"mso-height":case"mso-width":case"mso-vertical-align-alt":if(!/[ \t\r\n]*<")}}();var dtd=dom.dtd=(function(){function z(B){for(var A in B){B[A.toUpperCase()]=B[A]}return B}function a(E){var B=arguments;for(var D=1;D1||a!==b.parentNode){b.style.cssText=a.style.cssText+";"+b.style.cssText;a=a.parentNode;continue}else{a.style.cssText+=";"+b.style.cssText;if(a.tagName=="A"){a.style.textDecoration="underline"}}}if(a.tagName!="A"){a===b.parentNode&&domUtils.remove(b,true);break}}a=a.parentNode}},mergeSibling:function(c,b,a){function d(g,h,f){var e;if((e=f[g])&&!domUtils.isBookmarkNode(e)&&e.nodeType==1&&domUtils.isSameElement(f,e)){while(e.firstChild){if(h=="firstChild"){f.insertBefore(e.lastChild,f.firstChild)}else{f.appendChild(e.firstChild)}}domUtils.remove(e)}}!b&&d("previousSibling","firstChild",c);!a&&d("nextSibling","lastChild",c)},unSelectable:ie||browser.opera?function(c){c.onselectstart=function(){return false};c.onclick=c.onkeyup=c.onkeydown=function(){return false};c.unselectable="on";c.setAttribute("unselectable","on");for(var b=0,a;a=c.all[b++];){switch(a.tagName.toLowerCase()){case"iframe":case"textarea":case"input":case"select":break;default:a.unselectable="on";c.setAttribute("unselectable","on")}}}:function(a){a.style.MozUserSelect=a.style.webkitUserSelect=a.style.KhtmlUserSelect="none"},removeAttributes:function(c,d){d=utils.isArray(d)?d:utils.trim(d).replace(/[ ]{2,}/g," ").split(" ");for(var b=0,a;a=d[b++];){a=attrFix[a]||a;switch(a){case"className":c[a]="";break;case"style":c.style.cssText="";!browser.ie&&c.removeAttributeNode(c.getAttributeNode("style"))}c.removeAttribute(a)}},createElement:function(c,a,b){return domUtils.setAttributes(c.createElement(a),b)},setAttributes:function(c,b){for(var a in b){if(b.hasOwnProperty(a)){var d=b[a];switch(a){case"class":c.className=d;break;case"style":c.style.cssText=c.style.cssText+";"+d;break;case"innerHTML":c[a]=d;break;case"value":c.value=d;break;default:c.setAttribute(attrFix[a]||a,d)}}}return c},getComputedStyle:function(c,b){var g="width height top left";if(g.indexOf(b)>-1){return c["offset"+b.replace(/^\w/,function(e){return e.toUpperCase()})]+"px"}if(c.nodeType==3){c=c.parentNode}if(browser.ie&&browser.version<9&&b=="font-size"&&!c.style.fontSize&&!dtd.$empty[c.tagName]&&!dtd.$nonChild[c.tagName]){var d=c.ownerDocument.createElement("span");d.style.cssText="padding:0;border:0;font-family:simsun;";d.innerHTML=".";c.appendChild(d);var a=d.offsetHeight;c.removeChild(d);d=null;return a+"px"}try{var f=domUtils.getStyle(c,b)||(window.getComputedStyle?domUtils.getWindow(c).getComputedStyle(c,"").getPropertyValue(b):(c.currentStyle||c.style)[utils.cssStyleToDomStyle(b)])}catch(h){return""}return utils.transUnitToPx(utils.fixColor(b,f))},removeClasses:function(e,d){d=utils.isArray(d)?d:utils.trim(d).replace(/[ ]{2,}/g," ").split(" ");for(var c=0,b,a=e.className;b=d[c++];){a=a.replace(new RegExp("\\b"+b+"\\b"),"")}a=utils.trim(a).replace(/[ ]{2,}/g," ");if(a){e.className=a}else{domUtils.removeAttributes(e,["class"])}},addClass:function(e,d){if(!e){return}d=utils.trim(d).replace(/[ ]{2,}/g," ").split(" ");for(var c=0,b,a=e.className;b=d[c++];){if(!new RegExp("\\b"+b+"\\b").test(a)){e.className+=" "+b}}},hasClass:function(d,e){if(utils.isRegExp(e)){return e.test(d.className)}e=utils.trim(e).replace(/[ ]{2,}/g," ").split(" ");for(var c=0,b,a=d.className;b=e[c++];){if(!new RegExp("\\b"+b+"\\b","i").test(a)){return false}}return c-1==e.length},preventDefault:function(a){a.preventDefault?a.preventDefault():(a.returnValue=false)},removeStyle:function(b,a){if(browser.ie&&browser.version>8){b.style.cssText=b.style.cssText.replace(new RegExp(a+"s*:s*[^;]+;?"),"")}else{if(b.style.removeProperty){b.style.removeProperty(a)}else{b.style.removeAttribute(utils.cssStyleToDomStyle(a))}}if(!b.style.cssText){domUtils.removeAttributes(b,["style"])}},getStyle:function(b,a){var c=b.style[utils.cssStyleToDomStyle(a)];return utils.fixColor(a,c)},setStyle:function(b,a,c){b.style[utils.cssStyleToDomStyle(a)]=c},setStyles:function(b,c){for(var a in c){if(c.hasOwnProperty(a)){domUtils.setStyle(b,a,c[a])}}},removeDirtyAttr:function(d){for(var c=0,b,a=d.getElementsByTagName("*");b=a[c++];){b.removeAttribute("_moz_dirty")}d.removeAttribute("_moz_dirty")},getChildCount:function(c,a){var b=0,d=c.firstChild;a=a||function(){return 1};while(d){if(a(d)){b++}d=d.nextSibling}return b},isEmptyNode:function(a){return !a.firstChild||domUtils.getChildCount(a,function(b){return !domUtils.isBr(b)&&!domUtils.isBookmarkNode(b)&&!domUtils.isWhitespace(b)})==0},clearSelectedArr:function(a){var b;while(b=a.pop()){domUtils.removeAttributes(b,["class"])}},scrollToView:function(c,i,a){var b=function(){var j=i.document,k=j.compatMode=="CSS1Compat";return{width:(k?j.documentElement.clientWidth:j.body.clientWidth)||0,height:(k?j.documentElement.clientHeight:j.body.clientHeight)||0}},h=function(k){if("pageXOffset" in k){return{x:k.pageXOffset||0,y:k.pageYOffset||0}}else{var j=k.document;return{x:j.documentElement.scrollLeft||j.body.scrollLeft||0,y:j.documentElement.scrollTop||j.body.scrollTop||0}}};var f=b().height,g=f*-1+a;g+=(c.offsetHeight||0);var d=domUtils.getXY(c);g+=d.y;var e=h(i).y;if(g>e||g0){return 0}for(var c in dtd.$isNotEmpty){if(b.getElementsByTagName(c).length){return 0}}return 1},setViewportOffset:function(a,g){var f=parseInt(a.style.left)|0;var e=parseInt(a.style.top)|0;var c=a.getBoundingClientRect();var d=g.left-c.left;var b=g.top-c.top;if(d){a.style.left=f+d+"px"}if(b){a.style.top=e+b+"px"}},fillNode:function(c,b){var a=browser.ie?c.createTextNode(domUtils.fillChar):c.createElement("br");b.innerHTML="";b.appendChild(a)},moveChild:function(c,a,b){while(c.firstChild){if(b&&a.firstChild){a.insertBefore(c.lastChild,a.firstChild)}else{a.appendChild(c.firstChild)}}},hasNoAttributes:function(a){return browser.ie?/^<\w+\s*?>/.test(a.outerHTML):a.attributes.length==0},isCustomeNode:function(a){return a.nodeType==1&&a.getAttribute("_ue_custom_node_")},isTagNode:function(b,a){return b.nodeType==1&&new RegExp(b.tagName,"i").test(a)},filterNodeList:function(d,c,b){var a=[];if(!utils.isFunction(c)){var e=c;c=function(f){return utils.indexOf(utils.isArray(e)?e:e.split(" "),f.tagName.toLowerCase())!=-1}}utils.each(d,function(f){c(f)&&a.push(f)});return a.length==0?null:a.length==1||!b?a[0]:a},isInNodeEndBoundary:function(a,b){var c=a.startContainer;if(c.nodeType==3&&a.startOffset!=c.nodeValue.length){return 0}if(c.nodeType==1&&a.startOffset!=c.childNodes.length){return 0}while(c!==b){if(c.nextSibling){return 0}c=c.parentNode}return 1},isBoundaryNode:function(c,a){var b;while(!domUtils.isBody(c)){b=c;c=c.parentNode;if(b!==c[a]){return false}}return true}};var fillCharReg=new RegExp(domUtils.fillChar,"g");(function(){var f=0,g=domUtils.fillChar,c;function b(k){k.collapsed=k.startContainer&&k.endContainer&&k.startContainer===k.endContainer&&k.startOffset==k.endOffset}function j(k){return !k.collapsed&&k.startContainer.nodeType==1&&k.startContainer===k.endContainer&&k.endOffset-k.startOffset==1}function a(l,m,n,k){if(m.nodeType==1&&(dtd.$empty[m.tagName]||dtd.$nonChild[m.tagName])){n=domUtils.getNodeIndex(m)+(l?0:1);m=m.parentNode}if(l){k.startContainer=m;k.startOffset=n;if(!k.endContainer){k.collapse(true)}}else{k.endContainer=m;k.endOffset=n;if(!k.startContainer){k.collapse(false)}}b(k);return k}function i(q,u){var o=q.startContainer,n=q.endContainer,w=q.startOffset,p=q.endOffset,C=q.document,k=C.createDocumentFragment(),r,t;if(o.nodeType==1){o=o.childNodes[w]||(r=o.appendChild(C.createTextNode("")))}if(n.nodeType==1){n=n.childNodes[p]||(t=n.appendChild(C.createTextNode("")))}if(o===n&&o.nodeType==3){k.appendChild(C.createTextNode(o.substringData(w,p-w)));if(u){o.deleteData(w,p-w);q.collapse(true)}return k}var s,y,A=k,z=domUtils.findParents(o,true),l=domUtils.findParents(n,true);for(var x=0;z[x]==l[x];){x++}for(var v=x,B;B=z[v];v++){s=B.nextSibling;if(B==o){if(!r){if(q.startContainer.nodeType==3){A.appendChild(C.createTextNode(o.nodeValue.slice(w)));if(u){o.deleteData(w,o.nodeValue.length-w)}}else{A.appendChild(!u?o.cloneNode(true):o)}}}else{y=B.cloneNode(false);A.appendChild(y)}while(s){if(s===n||s===l[v]){break}B=s.nextSibling;A.appendChild(!u?s.cloneNode(true):s);s=B}A=y}A=k;if(!z[x]){A.appendChild(z[x-1].cloneNode(false));A=A.firstChild}for(var v=x,m;m=l[v];v++){s=m.previousSibling;if(m==n){if(!t&&q.endContainer.nodeType==3){A.appendChild(C.createTextNode(n.substringData(0,p)));if(u){n.deleteData(0,p)}}}else{y=m.cloneNode(false);A.appendChild(y)}if(v!=x||!z[x]){while(s){if(s===o){break}m=s.previousSibling;A.insertBefore(!u?s.cloneNode(true):s,A.firstChild);s=m}}A=y}if(u){q.setStartBefore(!l[x]?l[x-1]:!z[x]?z[x-1]:l[x]).collapse(true)}r&&domUtils.remove(r);t&&domUtils.remove(t);return k}var d=dom.Range=function(k){var l=this;l.startContainer=l.startOffset=l.endContainer=l.endOffset=null;l.document=k;l.collapsed=true};function e(n,k){try{if(c&&domUtils.inDoc(c,n)){if(!c.nodeValue.replace(fillCharReg,"").length){var l=c.parentNode;domUtils.remove(c);while(l&&domUtils.isEmptyInlineElement(l)&&(browser.safari?!(domUtils.getPosition(l,k)&domUtils.POSITION_CONTAINS):!l.contains(k))){c=l.parentNode;domUtils.remove(l);l=c}}else{c.nodeValue=c.nodeValue.replace(fillCharReg,"")}}}catch(m){}}function h(m,k){var l;m=m[k];while(m&&domUtils.isFillChar(m)){l=m[k];domUtils.remove(m);m=l}}d.prototype={cloneContents:function(){return this.collapsed?null:i(this,0)},deleteContents:function(){var k;if(!this.collapsed){i(this,1)}if(browser.webkit){k=this.startContainer;if(k.nodeType==3&&!k.nodeValue.length){this.setStartBefore(k).collapse(true);domUtils.remove(k)}}return this},extractContents:function(){return this.collapsed?null:i(this,2)},setStart:function(k,l){return a(true,k,l,this)},setEnd:function(k,l){return a(false,k,l,this)},setStartAfter:function(k){return this.setStart(k.parentNode,domUtils.getNodeIndex(k)+1)},setStartBefore:function(k){return this.setStart(k.parentNode,domUtils.getNodeIndex(k))},setEndAfter:function(k){return this.setEnd(k.parentNode,domUtils.getNodeIndex(k)+1)},setEndBefore:function(k){return this.setEnd(k.parentNode,domUtils.getNodeIndex(k))},setStartAtFirst:function(k){return this.setStart(k,0)},setStartAtLast:function(k){return this.setStart(k,k.nodeType==3?k.nodeValue.length:k.childNodes.length)},setEndAtFirst:function(k){return this.setEnd(k,0)},setEndAtLast:function(k){return this.setEnd(k,k.nodeType==3?k.nodeValue.length:k.childNodes.length)},selectNode:function(k){return this.setStartBefore(k).setEndAfter(k)},selectNodeContents:function(k){return this.setStart(k,0).setEndAtLast(k)},cloneRange:function(){var k=this;return new d(k.document).setStart(k.startContainer,k.startOffset).setEnd(k.endContainer,k.endOffset)},collapse:function(k){var l=this;if(k){l.endContainer=l.startContainer;l.endOffset=l.startOffset}else{l.startContainer=l.endContainer;l.startOffset=l.endOffset}l.collapsed=true;return l},shrinkBoundary:function(m){var l=this,o,n=l.collapsed;function k(p){return p.nodeType==1&&!domUtils.isBookmarkNode(p)&&!dtd.$empty[p.tagName]&&!dtd.$nonChild[p.tagName]}while(l.startContainer.nodeType==1&&(o=l.startContainer.childNodes[l.startOffset])&&k(o)){l.setStart(o,0)}if(n){return l.collapse(true)}if(!m){while(l.endContainer.nodeType==1&&l.endOffset>0&&(o=l.endContainer.childNodes[l.endOffset-1])&&k(o)){l.setEnd(o,o.childNodes.length)}}return l},getCommonAncestor:function(l,m){var n=this,o=n.startContainer,k=n.endContainer;if(o===k){if(l&&j(this)){o=o.childNodes[n.startOffset];if(o.nodeType==1){return o}}return m&&o.nodeType==3?o.parentNode:o}return domUtils.getCommonAncestor(o,k)},trimBoundary:function(l){this.txtToElmBoundary();var p=this.startContainer,o=this.startOffset,n=this.collapsed,k=this.endContainer;if(p.nodeType==3){if(o==0){this.setStartBefore(p)}else{if(o>=p.nodeValue.length){this.setStartAfter(p)}else{var m=domUtils.split(p,o);if(p===k){this.setEnd(m,this.endOffset-o)}else{if(p.parentNode===k){this.endOffset+=1}}this.setStartBefore(m)}}if(n){return this.collapse(true)}}if(!l){o=this.endOffset;k=this.endContainer;if(k.nodeType==3){if(o==0){this.setEndBefore(k)}else{o=l.nodeValue.length){m["set"+o.replace(/(\w)/,function(p){return p.toUpperCase()})+"After"](l)}}}}if(!this.collapsed){k(this,"start");k(this,"end")}return this},insertNode:function(m){var o=m,l=1;if(m.nodeType==11){o=m.firstChild;l=m.childNodes.length}this.trimBoundary(true);var p=this.startContainer,n=this.startOffset;var k=p.childNodes[n];if(k){p.insertBefore(m,k)}else{p.appendChild(m)}if(o.parentNode===this.endContainer){this.endOffset=this.endOffset+l}return this.setStartBefore(o)},setCursor:function(l,k){return this.collapse(!l).select(k)},createBookmark:function(m,n){var k,l=this.document.createElement("span");l.style.cssText="display:none;line-height:0px;";l.appendChild(this.document.createTextNode("\u200D"));l.id="_baidu_bookmark_start_"+(n?"":f++);if(!this.collapsed){k=l.cloneNode(true);k.id="_baidu_bookmark_end_"+(n?"":f++)}this.insertNode(l);if(k){this.collapse().insertNode(k).setEndBefore(k)}this.setStartAfter(l);return{start:m?l.id:l,end:k?m?k.id:k:null,id:m}},moveToBookmark:function(l){var m=l.id?this.document.getElementById(l.start):l.start,k=l.end&&l.id?this.document.getElementById(l.end):l.end;this.setStartBefore(m);domUtils.remove(m);if(k){this.setEndBefore(k);domUtils.remove(k)}else{this.collapse(true)}return this},enlarge:function(l,o){var k=domUtils.isBody,p,n,m=this.document.createTextNode("");if(l){n=this.startContainer;if(n.nodeType==1){if(n.childNodes[this.startOffset]){p=n=n.childNodes[this.startOffset]}else{n.appendChild(m);p=n=m}}else{p=n}while(1){if(domUtils.isBlockElm(n)){n=p;while((p=n.previousSibling)&&!domUtils.isBlockElm(p)){n=p}this.setStartBefore(n);break}p=n;n=n.parentNode}n=this.endContainer;if(n.nodeType==1){if(p=n.childNodes[this.endOffset]){n.insertBefore(m,p)}else{n.appendChild(m)}p=n=m}else{p=n}while(1){if(domUtils.isBlockElm(n)){n=p;while((p=n.nextSibling)&&!domUtils.isBlockElm(p)){n=p}this.setEndAfter(n);break}p=n;n=n.parentNode}if(m.parentNode===this.endContainer){this.endOffset--}domUtils.remove(m)}if(!this.collapsed){while(this.startOffset==0){if(o&&o(this.startContainer)){break}if(k(this.startContainer)){break}this.setStartBefore(this.startContainer)}while(this.endOffset==(this.endContainer.nodeType==1?this.endContainer.childNodes.length:this.endContainer.nodeValue.length)){if(o&&o(this.endContainer)){break}if(k(this.endContainer)){break}this.setEndAfter(this.endContainer)}}return this},adjustmentBoundary:function(){if(!this.collapsed){while(!domUtils.isBody(this.startContainer)&&this.startOffset==this.startContainer[this.startContainer.nodeType==3?"nodeValue":"childNodes"].length){this.setStartAfter(this.startContainer)}while(!domUtils.isBody(this.endContainer)&&!this.endOffset){this.setEndBefore(this.endContainer)}}return this},applyInlineStyle:function(m,x,t){if(this.collapsed){return this}this.trimBoundary().enlarge(false,function(B){return B.nodeType==1&&domUtils.isBlockElm(B)}).adjustmentBoundary();var u=this.createBookmark(),p=u.end,z=function(B){return B.nodeType==1?B.tagName.toLowerCase()!="br":!domUtils.isWhitespace(B)},s=domUtils.getNextDomNode(u.start,false,z),n,o,r=this.cloneRange();while(s&&(domUtils.getPosition(s,p)&domUtils.POSITION_PRECEDING)){if(s.nodeType==3||dtd[m][s.tagName]){r.setStartBefore(s);n=s;while(n&&(n.nodeType==3||dtd[m][n.tagName])&&n!==p){o=n;n=domUtils.getNextDomNode(n,n.nodeType==1,null,function(B){return dtd[m][B.tagName]})}var y=r.setEndAfter(o).extractContents(),v;if(t&&t.length>0){var k,w;w=k=t[0].cloneNode(false);for(var q=1,A;A=t[q++];){k.appendChild(A.cloneNode(false));k=k.firstChild}v=k}else{v=r.document.createElement(m)}if(x){domUtils.setAttributes(v,x)}v.appendChild(y);r.insertNode(t?w:v);var l;if(m=="span"&&x.style&&/text\-decoration/.test(x.style)&&(l=domUtils.findParentByTagName(v,"a",true))){domUtils.setAttributes(l,x);domUtils.remove(v,true);v=l}else{domUtils.mergeSibling(v);domUtils.clearEmptySibling(v)}domUtils.mergeChild(v,x);s=domUtils.getNextDomNode(v,false,z);domUtils.mergeToParent(v);if(n===p){break}}else{s=domUtils.getNextDomNode(s,true,z)}}return this.moveToBookmark(u)},removeInlineStyle:function(k){if(this.collapsed){return this}k=utils.isArray(k)?k:[k];this.shrinkBoundary().adjustmentBoundary();var r=this.startContainer,l=this.endContainer;while(1){if(r.nodeType==1){if(utils.indexOf(k,r.tagName.toLowerCase())>-1){break}if(r.tagName.toLowerCase()=="body"){r=null;break}}r=r.parentNode}while(1){if(l.nodeType==1){if(utils.indexOf(k,l.tagName.toLowerCase())>-1){break}if(l.tagName.toLowerCase()=="body"){l=null;break}}l=l.parentNode}var n=this.createBookmark(),q,p;if(r){p=this.cloneRange().setEndBefore(n.start).setStartBefore(r);q=p.extractContents();p.insertNode(q);domUtils.clearEmptySibling(r,true);r.parentNode.insertBefore(n.start,r)}if(l){p=this.cloneRange().setStartAfter(n.end).setEndAfter(l);q=p.extractContents();p.insertNode(q);domUtils.clearEmptySibling(l,false,true);l.parentNode.insertBefore(n.end,l.nextSibling)}var o=domUtils.getNextDomNode(n.start,false,function(s){return s.nodeType==1}),m;while(o&&o!==n.end){m=domUtils.getNextDomNode(o,true,function(s){return s.nodeType==1});if(utils.indexOf(k,o.tagName.toLowerCase())>-1){domUtils.remove(o,true)}o=m}return this.moveToBookmark(n)},getClosedNode:function(){var l;if(!this.collapsed){var k=this.cloneRange().adjustmentBoundary().shrinkBoundary();if(j(k)){var m=k.startContainer.childNodes[k.startOffset];if(m&&m.nodeType==1&&(dtd.$empty[m.tagName]||dtd.$nonChild[m.tagName])){l=m}}}return l},select:browser.ie?function(l,u){var q;if(!this.collapsed){this.shrinkBoundary()}var m=this.getClosedNode();if(m&&!u){try{q=this.document.body.createControlRange();q.addElement(m);q.select()}catch(r){}return this}var s=this.createBookmark(),k=s.start,n;q=this.document.body.createTextRange();q.moveToElementText(k);q.moveStart("character",1);if(!this.collapsed){var p=this.document.body.createTextRange();n=s.end;p.moveToElementText(n);q.setEndPoint("EndToEnd",p)}else{if(!l&&this.startContainer.nodeType!=3){var t=this.document.createTextNode(g),o=this.document.createElement("span");o.appendChild(this.document.createTextNode(g));k.parentNode.insertBefore(o,k);k.parentNode.insertBefore(t,k);e(this.document,t);c=t;h(o,"previousSibling");h(k,"nextSibling");q.moveStart("character",-1);q.collapse(true)}}this.moveToBookmark(s);o&&domUtils.remove(o);try{q.select()}catch(r){}return this}:function(k){function l(t){function s(v,w,u){if(v.nodeType==3&&v.nodeValue.length0){o=q-1}else{if(n<0){u=q+1}else{return{container:t,offset:h(j)}}}}if(q==-1){l.moveToElementText(t);l.setEndPoint("StartToStart",p);f=l.text.replace(/(\r\n|\r)/g,"\n").length;s=t.childNodes;if(!f){j=s[s.length-1];return{container:j,offset:j.nodeValue.length}}var m=s.length;while(f>0){f-=s[--m].nodeValue.length}return{container:s[m],offset:-f}}l.collapse(n>0);l.setEndPoint(n>0?"StartToStart":"EndToStart",p);f=l.text.replace(/(\r\n|\r)/g,"\n").length;if(!f){return dtd.$empty[j.tagName]||dtd.$nonChild[j.tagName]?{container:t,offset:h(j)+(n>0?0:1)}:{container:j,offset:n>0?0:j.childNodes.length}}while(f>0){try{var k=j;j=j[n>0?"previousSibling":"nextSibling"];f-=j.nodeValue.length}catch(r){return{container:t,offset:h(k)}}}return{container:j,offset:n>0?-f:j.nodeValue.length+f}}function c(g,f){if(g.item){f.selectNode(g.item(0))}else{var e=d(g,true);f.setStart(e.container,e.offset);if(g.compareEndPoints("StartToEnd",g)!=0){e=d(g,false);f.setEnd(e.container,e.offset)}}return f}function b(h){var g;try{g=h.getNative().createRange()}catch(i){return null}var f=g.item?g.item(0):g.parentElement();if((f.ownerDocument||f)===h.document){return g}return null}var a=dom.Selection=function(g){var f=this,e;f.document=g;if(ie){e=domUtils.getWindow(g).frameElement;domUtils.on(e,"beforedeactivate",function(){f._bakIERange=f.getIERange()});domUtils.on(e,"activate",function(){try{if(!b(f)&&f._bakIERange){f._bakIERange.select()}}catch(h){}f._bakIERange=null})}e=g=null};a.prototype={getNative:function(){var g=this.document;try{return !g?null:ie?g.selection:domUtils.getWindow(g).getSelection()}catch(f){return null}},getIERange:function(){var e=b(this);if(!e){if(this._bakIERange){return this._bakIERange}}return e},cache:function(){this.clear();this._cachedRange=this.getRange();this._cachedStartElement=this.getStart();this._cachedStartElementPath=this.getStartElementPath()},getStartElementPath:function(){if(this._cachedStartElementPath){return this._cachedStartElementPath}var e=this.getStart();if(e){return domUtils.findParents(e,true,null,true)}return[]},clear:function(){this._cachedStartElementPath=this._cachedRange=this._cachedStartElement=null},isFocus:function(){try{return browser.ie&&b(this)||!browser.ie&&this.getNative().rangeCount?true:false}catch(f){return false}},getRange:function(){var i=this;function h(e){var o=i.document.body.firstChild,n=e.collapsed;while(o&&o.firstChild){e.setStart(o,0);o=o.firstChild}if(!e.startContainer){e.setStart(i.document.body,0)}if(n){e.collapse(true)}}if(i._cachedRange!=null){return this._cachedRange}var g=new baidu.editor.dom.Range(i.document);if(ie){var k=i.getIERange();if(k){try{c(k,g)}catch(l){h(g)}}else{h(g)}}else{var j=i.getNative();if(j&&j.rangeCount){var f=j.getRangeAt(0);var m=j.getRangeAt(j.rangeCount-1);g.setStart(f.startContainer,f.startOffset).setEnd(m.endContainer,m.endOffset);if(g.collapsed&&domUtils.isBody(g.startContainer)&&!g.startOffset){h(g)}}else{if(this._bakRange&&domUtils.inDoc(this._bakRange.startContainer,this.document)){return this._bakRange}h(g)}}return this._bakRange=g},getStart:function(){if(this._cachedStartElement){return this._cachedStartElement}var e=ie?this.getIERange():this.getRange(),h,i,f,g;if(ie){if(!e){return this.document.body.firstChild}if(e.item){return e.item(0)}h=e.duplicate();h.text.length>0&&h.moveStart("character",1);h.collapse(1);i=h.parentElement();g=f=e.parentElement();while(f=f.parentNode){if(f==i){i=g;break}}}else{e.shrinkBoundary();i=e.startContainer;if(i.nodeType==1&&i.hasChildNodes()){i=i.childNodes[Math.min(i.childNodes.length-1,e.startOffset)]}if(i.nodeType==3){return i.parentNode}}return i},getText:function(){var e,f;if(this.isFocus()&&(e=this.getNative())){f=browser.ie?e.createRange():e.getRangeAt(0);return browser.ie?f.text:f.toString()}return""},clearRange:function(){this.getNative()[browser.ie?"empty":"removeAllRanges"]()}}})();(function(){var d=0,b;function c(m){var l=m.getElementsByTagName("img"),k;for(var j=0,h;h=l[j++];){if(k=h.getAttribute("orgSrc")){h.src=k;h.removeAttribute("orgSrc")}}var g=m.getElementsByTagName("a");for(var j=0,f;f=g[j++];j++){if(f.getAttribute("data_ue_src")){f.setAttribute("href",f.getAttribute("data_ue_src"))}}}function e(l,k){var f;if(k.textarea){if(utils.isString(k.textarea)){for(var h=0,j,g=domUtils.getElementsByTagName(l,"textarea");j=g[h++];){if(j.id=="ueditor_textarea_"+k.options.textarea){f=j;break}}}else{f=k.textarea}}if(!f){l.appendChild(f=domUtils.createElement(document,"textarea",{name:k.options.textarea,id:"ueditor_textarea_"+k.options.textarea,style:"display:none"}));k.textarea=f}f.value=k.hasContents()?(k.options.allHtmlEnabled?k.getAllHtml():k.getContent(null,null,true)):""}var a=UE.Editor=function(f){var g=this;g.uid=d++;EventBase.call(g);g.commands={};g.options=utils.extend(utils.clone(f||{}),UEDITOR_CONFIG,true);g.shortcutkeys={};g.setOpt({isShow:true,initialContent:"\u6b22\u8fce\u4f7f\u7528ueditor!",autoClearinitialContent:false,iframeCssUrl:g.options.UEDITOR_HOME_URL+"themes/iframe.css",textarea:"editorValue",focus:false,initialFrameWidth:1000,initialFrameHeight:g.options.minFrameHeight||320,minFrameWidth:800,minFrameHeight:220,autoClearEmptyNode:true,fullscreen:false,readonly:false,zIndex:999,imagePopup:true,enterTag:"p",pageBreakTag:"_baidu_page_break_tag_",customDomain:false,lang:"zh-cn",langPath:g.options.UEDITOR_HOME_URL+"lang/",theme:"default",themePath:g.options.UEDITOR_HOME_URL+"themes/",allHtmlEnabled:false,scaleEnabled:false,tableNativeEditInFF:false});utils.loadFile(document,{src:g.options.langPath+g.options.lang+"/"+g.options.lang+".js",tag:"script",type:"text/javascript",defer:"defer"},function(){for(var h in UE.plugins){UE.plugins[h].call(g)}g.langIsReady=true;g.fireEvent("langReady")});UE.instants["ueditorInstant"+g.uid]=g};a.prototype={ready:function(f){var g=this;if(f){g.isReady?f.apply(g):g.addListener("ready",f)}},setOpt:function(f,h){var g={};if(utils.isString(f)){g[f]=h}else{g=f}utils.extend(this.options,g,true)},destroy:function(){var i=this;i.fireEvent("destroy");var g=i.container.parentNode;var f=i.textarea;if(!f){f=document.createElement("textarea");g.parentNode.insertBefore(f,g)}else{f.style.display=""}f.style.width=g.offsetWidth+"px";f.style.height=g.offsetHeight+"px";f.value=i.getContent();f.id=i.key;g.innerHTML="";domUtils.remove(g);var h=i.key;for(var j in i){if(i.hasOwnProperty(j)){delete this[j]}}UE.delEditor(h)},render:function(g){var j=this,h=j.options;if(utils.isString(g)){g=document.getElementById(g)}if(g){var f=ie&&browser.version<9,i=(ie&&browser.version<9?"":"")+""+(h.iframeCssUrl?"":"")+"";if(h.customDomain&&document.domain!=location.hostname){i+="