(function(){function ba(f,a,d){var c;a=a.toLowerCase();return(c=f.__allListeners||d&&(f.__allListeners={}))&&(c[a]||d&&(c[a]=[]))}function X(f,a,d,c,b,h){c=c&&f[a];var g;for(!c&&(c=f[d]);!c&&(g=(g||f).parentNode);){if("BODY"==g.tagName||h&&!h(g))return null;c=g[d]}return c&&b&&!b(c)?X(c,a,d,!1,b):c}UEDITOR_CONFIG=window.UEDITOR_CONFIG||{};var q=window.baidu||{};window.baidu=q;window.UE=q.editor={};UE.plugins={};UE.commands={};UE.instants={};UE.I18N={};UE.version="1.2.6.1";var K=UE.dom={},r=UE.browser= function(){var f=navigator.userAgent.toLowerCase(),a=window.opera,d={ie:!!window.ActiveXObject,opera:!!a&&a.version,webkit:-1c||d.quirks);if(d.gecko){var b=f.match(/rv:([\d\.]+)/);b&&(b=b[1].split("."),c=1E4*b[0]+100*(b[1]||0)+1*(b[2]||0))}/chrome\/(\d+\.\d)/i.test(f)&&(d.chrome=+RegExp.$1);/(\d+\.\d)?(?:\.\d)?\s+safari\/?(\d+\.\d+)?/i.test(f)&&!/chrome/i.test(f)&&(d.safari=+(RegExp.$1||RegExp.$2));d.opera&&(c=parseFloat(a.version()));d.webkit&&(c=parseFloat(f.match(/ applewebkit\/(\d+)/)[1]));d.version=c;d.isCompatible=!d.mobile&&(d.ie&&6<=c||d.gecko&&10801<=c||d.opera&&9.5<=c||d.air&&1<=c||d.webkit&&522<= c||!1);return d}(),E=r.ie,ja=r.opera,p=UE.utils={each:function(f,a,d){if(null!=f)if(f.length===+f.length)for(var c=0,b=f.length;c=d&&b===a)return c=h,!1});return c},removeItem:function(f,a){for(var d=0,c=f.length;d< c;d++)f[d]===a&&(f.splice(d,1),d--)},trim:function(f){return f.replace(/(^[ \t\n\r]+)|([ \t\n\r]+$)/g,"")},listToMap:function(f){if(!f)return{};f=p.isArray(f)?f:f.split(",");for(var a=0,d,c={};d=f[a++];)c[d.toUpperCase()]=c[d]=1;return c},unhtml:function(f,a){return f?f.replace(a||/[&<">'](?:(amp|lt|quot|gt|#39|nbsp);)?/g,function(a,c){return c?a:{"<":"<","&":"&",'"':""",">":">","'":"'"}[a]}):""},html:function(f){return f?f.replace(/&((g|l|quo)t|amp|#39);/g,function(a){return{"<":"<", "&":"&",""":'"',">":">","'":"'"}[a]}):""},cssStyleToDomStyle:function(){var f=document.createElement("div").style,a={"float":void 0!=f.cssFloat?"cssFloat":void 0!=f.styleFloat?"styleFloat":"float"};return function(d){return a[d]||(a[d]=d.toLowerCase().replace(/-./g,function(a){return a.charAt(1).toUpperCase()}))}}(),loadFile:function(){function f(d,c){try{for(var b=0,h;h=a[b++];)if(h.doc===d&&h.url==(c.src||c.href))return h}catch(g){return null}}var a=[];return function(d,c,b){var h= f(d,c);if(h)h.ready?b&&b():h.funs.push(b);else if(a.push({doc:d,url:c.src||c.href,funs:[b]}),!d.body){b=[];for(var g in c)"tag"!=g&&b.push(g+'="'+c[g]+'"');d.write("<"+c.tag+" "+b.join(" ")+" >")}else if(!c.id||!d.getElementById(c.id)){var k=d.createElement(c.tag);delete c.tag;for(g in c)k.setAttribute(g,c[g]);k.onload=k.onreadystatechange=function(){if(!this.readyState||/loaded|complete/.test(this.readyState)){h=f(d,c);if(0r.version?{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor", "class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder"}:{tabindex:"tabIndex",readonly:"readOnly"},pa=p.listToMap("-webkit-box -moz-box block list-item table table-row-group table-header-group table-footer-group table-row table-column-group table-column table-cell table-caption".split(" ")),e=K.domUtils={NODE_ELEMENT:1,NODE_DOCUMENT:9,NODE_TEXT:3,NODE_COMMENT:8,NODE_DOCUMENT_FRAGMENT:11, POSITION_IDENTICAL:0,POSITION_DISCONNECTED:1,POSITION_FOLLOWING:2,POSITION_PRECEDING:4,POSITION_IS_CONTAINED:8,POSITION_CONTAINS:16,fillChar:E&&"6"==r.version?"\ufeff":"\u200b",keys:{8:1,46:1,16:1,17:1,18:1,37:1,38:1,39:1,40:1,13:1},getPosition:function(e,a){if(e===a)return 0;var d,c=[e],b=[a];for(d=e;d=d.parentNode;){if(d===a)return 10;c.push(d)}for(d=a;d=d.parentNode;){if(d===e)return 20;b.push(d)}c.reverse();b.reverse();if(c[0]!==b[0])return 1;for(d=-1;d++,c[d]===b[d];);e=c[d];for(a=b[d];e=e.nextSibling;)if(e=== a)return 4;return 2},getNodeIndex:function(e,a){for(var d=e,c=0;d=d.previousSibling;)a&&3==d.nodeType?d.nodeType!=d.nextSibling.nodeType&&c++:c++;return c},inDoc:function(f,a){return 10==e.getPosition(f,a)},findParent:function(f,a,d){if(f&&!e.isBody(f))for(f=d?f:f.parentNode;f;){if(!a||a(f)||e.isBody(f))return a&&!a(f)&&e.isBody(f)?null:f;f=f.parentNode}return null},findParentByTagName:function(f,a,d,c){a=p.listToMap(p.isArray(a)?a:[a]);return e.findParent(f,function(b){return a[b.tagName]&&!(c&& c(b))},d)},findParents:function(f,a,d,c){for(a=a&&(d&&d(f)||!d)?[f]:[];f=e.findParent(f,d);)a.push(f);return c?a:a.reverse()},insertAfter:function(e,a){return e.parentNode.insertBefore(a,e.nextSibling)},remove:function(e,a){var d=e.parentNode,c;if(d){if(a&&e.hasChildNodes())for(;c=e.firstChild;)d.insertBefore(c,e);d.removeChild(e)}return e},getNextDomNode:function(e,a,d,c){return X(e,"firstChild","nextSibling",a,d,c)},isBookmarkNode:function(e){return 1==e.nodeType&&e.id&&/^_baidu_bookmark_/i.test(e.id)}, getWindow:function(e){e=e.ownerDocument||e;return e.defaultView||e.parentWindow},getCommonAncestor:function(e,a){if(e===a)return e;for(var d=[e],c=[a],b=e,h=-1;b=b.parentNode;){if(b===a)return b;d.push(b)}for(b=a;b=b.parentNode;){if(b===e)return b;c.push(b)}d.reverse();for(c.reverse();h++,d[h]===c[h];);return 0==h?null:d[h-1]},clearEmptySibling:function(f,a,d){function c(a,c){for(var g;a&&!e.isBookmarkNode(a)&&(e.isEmptyInlineElement(a)||!RegExp("[^\t\n\r"+e.fillChar+"]").test(a.nodeValue));)g=a[c], e.remove(a),a=g}!a&&c(f.nextSibling,"nextSibling");!d&&c(f.previousSibling,"previousSibling")},split:function(f,a){var d=f.ownerDocument;if(r.ie&&a==f.nodeValue.length){var c=d.createTextNode("");return e.insertAfter(f,c)}c=f.splitText(a);r.ie8&&(d=d.createTextNode(""),e.insertAfter(c,d),e.remove(d));return c},isWhitespace:function(f){return!RegExp("[^ \t\n\r"+e.fillChar+"]").test(f.nodeValue)},getXY:function(e){for(var a=0,d=0;e.offsetParent;)d+=e.offsetTop,a+=e.offsetLeft,e=e.offsetParent;return{x:a, y:d}},on:function(e,a,d){var c=p.isArray(a)?a:[a],b=c.length;if(b)for(;b--;)if(a=c[b],e.addEventListener)e.addEventListener(a,d,!1);else{d._d||(d._d={els:[]});var h=a+d.toString(),g=p.indexOf(d._d.els,e);d._d[h]&&-1!=g||(-1==g&&d._d.els.push(e),d._d[h]||(d._d[h]=function(a){return d.call(a.srcElement,a||window.event)}),e.attachEvent("on"+a,d._d[h]))}e=null},un:function(e,a,d){var c=p.isArray(a)?a:[a],b=c.length;if(b)for(;b--;)if(a=c[b],e.removeEventListener)e.removeEventListener(a,d,!1);else{var h= a+d.toString();try{e.detachEvent("on"+a,d._d?d._d[h]:d)}catch(g){}d._d&&d._d[h]&&(a=p.indexOf(d._d.els,e),-1!=a&&d._d.els.splice(a,1),0==d._d.els.length&&delete d._d[h])}},isSameElement:function(f,a){if(f.tagName!=a.tagName)return!1;var d=f.attributes,c=a.attributes;if(!E&&d.length!=c.length)return!1;for(var b,h,g=0,k=0,l=0;b=d[l++];){if("style"==b.nodeName)if(b.specified&&g++,e.isSameStyle(f,a))continue;else return!1;if(E)if(b.specified)g++,h=c.getNamedItem(b.nodeName);else continue;else h=a.attributes[b.nodeName]; if(!h.specified||b.nodeValue!=h.nodeValue)return!1}if(E){for(l=0;h=c[l++];)h.specified&&k++;if(g!=k)return!1}return!0},isSameStyle:function(e,a){var d=e.style.cssText.replace(/( ?; ?)/g,";").replace(/( ?: ?)/g,":"),c=a.style.cssText.replace(/( ?; ?)/g,";").replace(/( ?: ?)/g,":");if(r.opera){d=e.style;c=a.style;if(d.length!=c.length)return!1;for(var b in d)if(!/^(\d+|csstext)$/i.test(b)&&d[b]!=c[b])return!1;return!0}if(!d||!c)return d==c;d=d.split(";");c=c.split(";");if(d.length!=c.length)return!1; b=0;for(var h;h=d[b++];)if(-1==p.indexOf(c,h))return!1;return!0},isBlockElm:function(f){return 1==f.nodeType&&(w.$block[f.tagName]||pa[e.getComputedStyle(f,"display")])&&!w.$nonChild[f.tagName]},isBody:function(e){return e&&1==e.nodeType&&"body"==e.tagName.toLowerCase()},breakParent:function(f,a){var d,c=f,b=f,h,g;do{c=c.parentNode;h?(d=c.cloneNode(!1),d.appendChild(h),h=d,d=c.cloneNode(!1),d.appendChild(g),g=d):(h=c.cloneNode(!1),g=h.cloneNode(!1));for(;d=b.previousSibling;)h.insertBefore(d,h.firstChild); for(;d=b.nextSibling;)g.appendChild(d);b=c}while(a!==c);d=a.parentNode;d.insertBefore(h,a);d.insertBefore(g,a);d.insertBefore(f,g);e.remove(a);return f},isEmptyInlineElement:function(f){if(1!=f.nodeType||!w.$removeEmpty[f.tagName])return 0;for(f=f.firstChild;f;){if(e.isBookmarkNode(f)||1==f.nodeType&&!e.isEmptyInlineElement(f)||3==f.nodeType&&!e.isWhitespace(f))return 0;f=f.nextSibling}return 1},trimWhiteTextNode:function(f){function a(a){for(var c;(c=f[a])&&3==c.nodeType&&e.isWhitespace(c);)f.removeChild(c)} a("firstChild");a("lastChild")},mergeChild:function(f,a,d){a=e.getElementsByTagName(f,f.tagName.toLowerCase());for(var c=0,b;b=a[c++];)if(b.parentNode&&!e.isBookmarkNode(b))if("span"==b.tagName.toLowerCase()){if(f===b.parentNode&&(e.trimWhiteTextNode(f),1==f.childNodes.length)){f.style.cssText=b.style.cssText+";"+f.style.cssText;e.remove(b,!0);continue}b.style.cssText=f.style.cssText+";"+b.style.cssText;if(d){var h=d.style;if(h)for(var h=h.split(";"),g=0,k;k=h[g++];)b.style[p.cssStyleToDomStyle(k.split(":")[0])]= k.split(":")[1]}e.isSameStyle(b,f)&&e.remove(b,!0)}else e.isSameElement(f,b)&&e.remove(b,!0)},getElementsByTagName:function(f,a,d){if(d&&p.isString(d)){var c=d;d=function(a){return e.hasClass(a,c)}}a=p.trim(a).replace(/[ ]{2,}/g," ").split(" ");for(var b=[],h=0,g;g=a[h++];){g=f.getElementsByTagName(g);for(var k=0,l;l=g[k++];)d&&!d(l)||b.push(l)}return b},mergeToParent:function(f){for(var a=f.parentNode;a&&w.$removeEmpty[a.tagName];){if(a.tagName==f.tagName||"A"==a.tagName){e.trimWhiteTextNode(a); if("SPAN"==a.tagName&&!e.isSameStyle(a,f)||"A"==a.tagName&&"SPAN"==f.tagName)if(1r.version&&"font-size"==a&&!f.style.fontSize&&!w.$empty[f.tagName]&&!w.$nonChild[f.tagName]){var d= f.ownerDocument.createElement("span");d.style.cssText="padding:0;border:0;font-family:simsun;";d.innerHTML=".";f.appendChild(d);var c=d.offsetHeight;f.removeChild(d);d=null;return c+"px"}try{d=e.getStyle(f,a)||(window.getComputedStyle?e.getWindow(f).getComputedStyle(f,"").getPropertyValue(a):(f.currentStyle||f.style)[p.cssStyleToDomStyle(a)])}catch(b){return""}return p.transUnitToPx(p.fixColor(a,d))},removeClasses:function(f,a){a=p.isArray(a)?a:p.trim(a).replace(/[ ]{2,}/g," ").split(" ");for(var d= 0,c,b=f.className;c=a[d++];)b=b.replace(RegExp("\\b"+c+"\\b"),"");(b=p.trim(b).replace(/[ ]{2,}/g," "))?f.className=b:e.removeAttributes(f,["class"])},addClass:function(e,a){if(e){a=p.trim(a).replace(/[ ]{2,}/g," ").split(" ");for(var d=0,c,b=e.className;c=a[d++];)RegExp("\\b"+c+"\\b").test(b)||(e.className+=" "+c)}},hasClass:function(e,a){if(p.isRegExp(a))return a.test(e.className);a=p.trim(a).replace(/[ ]{2,}/g," ").split(" ");for(var d=0,c,b=e.className;c=a[d++];)if(!RegExp("\\b"+c+"\\b","i").test(b))return!1; return d-1==a.length},preventDefault:function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},removeStyle:function(f,a){r.ie?("color"==a&&(a="(^|;)"+a),f.style.cssText=f.style.cssText.replace(RegExp(a+"[^:]*:[^;]+;?","ig"),"")):f.style.removeProperty?f.style.removeProperty(a):f.style.removeAttribute(p.cssStyleToDomStyle(a));f.style.cssText||e.removeAttributes(f,["style"])},getStyle:function(e,a){var d=e.style[p.cssStyleToDomStyle(a)];return p.fixColor(a,d)},setStyle:function(e,a,d){e.style[p.cssStyleToDomStyle(a)]= d;p.trim(e.style.cssText)||this.removeAttributes(e,"style")},setStyles:function(f,a){for(var d in a)a.hasOwnProperty(d)&&e.setStyle(f,d,a[d])},removeDirtyAttr:function(e){for(var a=0,d,c=e.getElementsByTagName("*");d=c[a++];)d.removeAttribute("_moz_dirty");e.removeAttribute("_moz_dirty")},getChildCount:function(e,a){var d=0,c=e.firstChild;for(a=a||function(){return 1};c;)a(c)&&d++,c=c.nextSibling;return d},isEmptyNode:function(f){return!f.firstChild||0==e.getChildCount(f,function(a){return!e.isBr(a)&& !e.isBookmarkNode(a)&&!e.isWhitespace(a)})},clearSelectedArr:function(f){for(var a;a=f.pop();)e.removeAttributes(a,["class"])},scrollToView:function(f,a,d){var c=function(){var b=a.document,c="CSS1Compat"==b.compatMode;return{width:(c?b.documentElement.clientWidth:b.body.clientWidth)||0,height:(c?b.documentElement.clientHeight:b.body.clientHeight)||0}}().height;d=-1*c+d+(f.offsetHeight||0);f=e.getXY(f);d+=f.y;f=function(a){if("pageXOffset"in a)return{x:a.pageXOffset||0,y:a.pageYOffset||0};a=a.document; return{x:a.documentElement.scrollLeft||a.body.scrollLeft||0,y:a.documentElement.scrollTop||a.body.scrollTop||0}}(a).y;(d>f||dd?-20:20))},isBr:function(e){return 1==e.nodeType&&"BR"==e.tagName},isFillChar:function(f,a){return 3==f.nodeType&&!f.nodeValue.replace(RegExp((a?"^":"")+e.fillChar),"").length},isStartInblock:function(f){f=f.cloneRange();var a=0,d=f.startContainer,c;if(1==d.nodeType&&d.childNodes[f.startOffset])for(var d=d.childNodes[f.startOffset],b=d.previousSibling;b&& e.isFillChar(b);)d=b,b=b.previousSibling;this.isFillChar(d,!0)&&1==f.startOffset&&(f.setStartBefore(d),d=f.startContainer);for(;d&&e.isFillChar(d);)c=d,d=d.previousSibling;c&&(f.setStartBefore(c),d=f.startContainer);for(1==d.nodeType&&(e.isEmptyNode(d)&&1==f.startOffset)&&f.setStart(d,0).collapse(!0);!f.startOffset;){d=f.startContainer;if(e.isBlockElm(d)||e.isBody(d)){a=1;break}var b=f.startContainer.previousSibling,h;if(b){for(;b&&e.isFillChar(b);)h=b,b=b.previousSibling;h?f.setStartBefore(h):f.setStartBefore(f.startContainer)}else f.setStartBefore(f.startContainer)}return a&& !e.isBody(f.startContainer)?1:0},isEmptyBlock:function(f,a){if(1!=f.nodeType)return 0;a=a||RegExp("[ \t\r\n"+e.fillChar+"]","g");if(0/.test(e.outerHTML):0==e.attributes.length},isCustomeNode:function(e){return 1==e.nodeType&&e.getAttribute("_ue_custom_node_")},isTagNode:function(e,a){return 1==e.nodeType&&RegExp("^"+e.tagName+"$","i").test(a)},filterNodeList:function(e, a,d){var c=[];if(!p.isFunction(a)){var b=a;a=function(a){return-1!=p.indexOf(p.isArray(b)?b:b.split(" "),a.tagName.toLowerCase())}}p.each(e,function(b){a(b)&&c.push(b)});return 0==c.length?null:1!=c.length&&d?c:c[0]},isInNodeEndBoundary:function(e,a){var d=e.startContainer;if(3==d.nodeType&&e.startOffset!=d.nodeValue.length||1==d.nodeType&&e.startOffset!=d.childNodes.length)return 0;for(;d!==a;){if(d.nextSibling)return 0;d=d.parentNode}return 1},isBoundaryNode:function(f,a){for(var d;!e.isBody(f);)if(d= f,f=f.parentNode,d!==f[a])return!1;return!0}},O=RegExp(e.fillChar,"g");(function(){function f(a){return!a.collapsed&&1==a.startContainer.nodeType&&a.startContainer===a.endContainer&&1==a.endOffset-a.startOffset}function a(a,g,b,c){1==g.nodeType&&(w.$empty[g.tagName]||w.$nonChild[g.tagName])&&(b=e.getNodeIndex(g)+(a?0:1),g=g.parentNode);a?(c.startContainer=g,c.startOffset=b,c.endContainer||c.collapse(!0)):(c.endContainer=g,c.endOffset=b,c.startContainer||c.collapse(!1));c.collapsed=c.startContainer&& c.endContainer&&c.startContainer===c.endContainer&&c.startOffset==c.endOffset;return c}function d(a,g){var b=a.startContainer,c=a.endContainer,k=a.startOffset,l=a.endOffset,d=a.document,h=d.createDocumentFragment(),f,C;1==b.nodeType&&(b=b.childNodes[k]||(f=b.appendChild(d.createTextNode(""))));1==c.nodeType&&(c=c.childNodes[l]||(C=c.appendChild(d.createTextNode(""))));if(b===c&&3==b.nodeType)return h.appendChild(d.createTextNode(b.substringData(k,l-k))),g&&(b.deleteData(k,l-k),a.collapse(!0)),h;for(var F, p,r=h,q=e.findParents(b,!0),w=e.findParents(c,!0),z=0;q[z]==w[z];)z++;for(var H=z,B;B=q[H];H++){F=B.nextSibling;B==b?f||(3==a.startContainer.nodeType?(r.appendChild(d.createTextNode(b.nodeValue.slice(k))),g&&b.deleteData(k,b.nodeValue.length-k)):r.appendChild(g?b:b.cloneNode(!0))):(p=B.cloneNode(!1),r.appendChild(p));for(;F&&F!==c&&F!==w[H];)B=F.nextSibling,r.appendChild(g?F:F.cloneNode(!0)),F=B;r=p}r=h;q[z]||(r.appendChild(q[z-1].cloneNode(!1)),r=r.firstChild);for(H=z;k=w[H];H++){F=k.previousSibling; k==c?C||3!=a.endContainer.nodeType||(r.appendChild(d.createTextNode(c.substringData(0,l))),g&&c.deleteData(0,l)):(p=k.cloneNode(!1),r.appendChild(p));if(H!=z||!q[z])for(;F&&F!==b;)k=F.previousSibling,r.insertBefore(g?F:F.cloneNode(!0),r.firstChild),F=k;r=p}g&&a.setStartBefore(w[z]?q[z]?w[z]:q[z-1]:w[z-1]).collapse(!0);f&&e.remove(f);C&&e.remove(C);return h}function c(a,g){try{if(k&&e.inDoc(k,a))if(k.nodeValue.replace(O,"").length)k.nodeValue=k.nodeValue.replace(O,"");else{var b=k.parentNode;for(e.remove(k);b&& e.isEmptyInlineElement(b)&&(r.safari?!(e.getPosition(b,g)&e.POSITION_CONTAINS):!b.contains(g));)k=b.parentNode,e.remove(b),b=k}}catch(c){}}function b(a,g){var b;for(a=a[g];a&&e.isFillChar(a);)b=a[g],e.remove(a),a=b}var h=0,g=e.fillChar,k,l=K.Range=function(a){this.startContainer=this.startOffset=this.endContainer=this.endOffset=null;this.document=a;this.collapsed=!0};l.prototype={cloneContents:function(){return this.collapsed?null:d(this,0)},deleteContents:function(){var a;this.collapsed||d(this, 1);r.webkit&&(a=this.startContainer,3!=a.nodeType||a.nodeValue.length||(this.setStartBefore(a).collapse(!0),e.remove(a)));return this},extractContents:function(){return this.collapsed?null:d(this,2)},setStart:function(g,b){return a(!0,g,b,this)},setEnd:function(g,b){return a(!1,g,b,this)},setStartAfter:function(a){return this.setStart(a.parentNode,e.getNodeIndex(a)+1)},setStartBefore:function(a){return this.setStart(a.parentNode,e.getNodeIndex(a))},setEndAfter:function(a){return this.setEnd(a.parentNode, e.getNodeIndex(a)+1)},setEndBefore:function(a){return this.setEnd(a.parentNode,e.getNodeIndex(a))},setStartAtFirst:function(a){return this.setStart(a,0)},setStartAtLast:function(a){return this.setStart(a,3==a.nodeType?a.nodeValue.length:a.childNodes.length)},setEndAtFirst:function(a){return this.setEnd(a,0)},setEndAtLast:function(a){return this.setEnd(a,3==a.nodeType?a.nodeValue.length:a.childNodes.length)},selectNode:function(a){return this.setStartBefore(a).setEndAfter(a)},selectNodeContents:function(a){return this.setStart(a, 0).setEndAtLast(a)},cloneRange:function(){return(new l(this.document)).setStart(this.startContainer,this.startOffset).setEnd(this.endContainer,this.endOffset)},collapse:function(a){a?(this.endContainer=this.startContainer,this.endOffset=this.startOffset):(this.startContainer=this.endContainer,this.startOffset=this.endOffset);this.collapsed=!0;return this},shrinkBoundary:function(a){function g(a){return 1==a.nodeType&&!e.isBookmarkNode(a)&&!w.$empty[a.tagName]&&!w.$nonChild[a.tagName]}for(var b,c= this.collapsed;1==this.startContainer.nodeType&&(b=this.startContainer.childNodes[this.startOffset])&&g(b);)this.setStart(b,0);if(c)return this.collapse(!0);if(!a)for(;1==this.endContainer.nodeType&&0=g.nodeValue.length)this.setStartAfter(g);else{var l=e.split(g,b);g===k?this.setEnd(l,this.endOffset-b):g.parentNode===k&&(this.endOffset+=1);this.setStartBefore(l)}if(c)return this.collapse(!0)}a||(b=this.endOffset,k=this.endContainer,3==k.nodeType&&(0==b?this.setEndBefore(k):(b=c.nodeValue.length)a["set"+b.replace(/(\w)/,function(a){return a.toUpperCase()})+"After"](c)}if(a||!this.collapsed)g(this,"start"),g(this,"end");return this},insertNode:function(a){var g=a,b=1;11==a.nodeType&&(g=a.firstChild,b=a.childNodes.length);this.trimBoundary(!0); var c=this.startContainer,k=c.childNodes[this.startOffset];k?c.insertBefore(a,k):c.appendChild(a);g.parentNode===this.endContainer&&(this.endOffset+=b);return this.setStartBefore(g)},setCursor:function(a,g){return this.collapse(!a).select(g)},createBookmark:function(a,g){var b,c=this.document.createElement("span");c.style.cssText="display:none;line-height:0px;";c.appendChild(this.document.createTextNode("\u200d"));c.id="_baidu_bookmark_start_"+(g?"":h++);this.collapsed||(b=c.cloneNode(!0),b.id="_baidu_bookmark_end_"+ (g?"":h++));this.insertNode(c);b&&this.collapse().insertNode(b).setEndBefore(b);this.setStartAfter(c);return{start:a?c.id:c,end:b?a?b.id:b:null,id:a}},moveToBookmark:function(a){var b=a.id?this.document.getElementById(a.start):a.start;a=a.end&&a.id?this.document.getElementById(a.end):a.end;this.setStartBefore(b);e.remove(b);a?(this.setEndBefore(a),e.remove(a)):this.collapse(!0);return this},enlarge:function(a,b){var g=e.isBody,c,k,l=this.document.createTextNode("");if(a){k=this.startContainer;1== k.nodeType?k.childNodes[this.startOffset]?c=k=k.childNodes[this.startOffset]:(k.appendChild(l),c=k=l):c=k;for(;;){if(e.isBlockElm(k)){for(k=c;(c=k.previousSibling)&&!e.isBlockElm(c);)k=c;this.setStartBefore(k);break}c=k;k=k.parentNode}k=this.endContainer;1==k.nodeType?((c=k.childNodes[this.endOffset])?k.insertBefore(l,c):k.appendChild(l),c=k=l):c=k;for(;;){if(e.isBlockElm(k)){for(k=c;(c=k.nextSibling)&&!e.isBlockElm(c);)k=c;this.setEndAfter(k);break}c=k;k=k.parentNode}l.parentNode===this.endContainer&& this.endOffset--;e.remove(l)}if(!this.collapsed){for(;!(0!=this.startOffset||b&&b(this.startContainer)||g(this.startContainer));)this.setStartBefore(this.startContainer);for(;!(this.endOffset!=(1==this.endContainer.nodeType?this.endContainer.childNodes.length:this.endContainer.nodeValue.length)||b&&b(this.endContainer)||g(this.endContainer));)this.setEndAfter(this.endContainer)}return this},adjustmentBoundary:function(){if(!this.collapsed){for(;!e.isBody(this.startContainer)&&this.startOffset==this.startContainer[3== this.startContainer.nodeType?"nodeValue":"childNodes"].length&&this.startContainer[3==this.startContainer.nodeType?"nodeValue":"childNodes"].length;)this.setStartAfter(this.startContainer);for(;!e.isBody(this.endContainer)&&!this.endOffset&&this.endContainer[3==this.endContainer.nodeType?"nodeValue":"childNodes"].length;)this.setEndBefore(this.endContainer)}return this},applyInlineStyle:function(a,b,g){if(this.collapsed)return this;this.trimBoundary().enlarge(!1,function(a){return 1==a.nodeType&& e.isBlockElm(a)}).adjustmentBoundary();for(var c=this.createBookmark(),k=c.end,l=function(a){return 1==a.nodeType?"br"!=a.tagName.toLowerCase():!e.isWhitespace(a)},d=e.getNextDomNode(c.start,!1,l),h,f,C=this.cloneRange();d&&e.getPosition(d,k)&e.POSITION_PRECEDING;)if(3==d.nodeType||w[a][d.tagName]){C.setStartBefore(d);for(h=d;h&&(3==h.nodeType||w[a][h.tagName])&&h!==k;)f=h,h=e.getNextDomNode(h,1==h.nodeType,null,function(b){return w[a][b.tagName]});var d=C.setEndAfter(f).extractContents(),p;if(g&& 0l&&(l=0);d.push(l);return d}var c={},k=this;c.startAddress=g(!0);a||(c.endAddress=k.collapsed?[].concat(c.startAddress):g());return c},moveToAddress:function(a,b){function g(a,b){for(var k=c.document.body,l,d,e=0,h,n=a.length;eu)m=t+1;else return{container:g,offset:d(l)}}if(-1==t){n.moveToElementText(g);n.setEndPoint("StartToStart",a);n=n.text.replace(/(\r\n|\r)/g,"\n").length;k=g.childNodes;if(!n)return l=k[k.length- 1],{container:l,offset:l.nodeValue.length};for(d=k.length;0r.ie?a.selection:e.getWindow(a).getSelection():null}catch(b){return null}},getIERange:function(){var a=d(this);return!a&&this._bakIERange?this._bakIERange:a},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 a=this.getStart();return a?e.findParents(a,!0,null,!0):[]},clear:function(){this._cachedStartElementPath=this._cachedRange=this._cachedStartElement=null},isFocus:function(){try{return r.ie&&d(this)||!r.ie&&this.getNative().rangeCount?!0:!1}catch(a){return!1}},getRange:function(){function c(a){for(var g=b.document.body.firstChild,c=a.collapsed;g&&g.firstChild;)a.setStart(g, 0),g=g.firstChild;a.startContainer||a.setStart(b.document.body,0);c&&a.collapse(!0)}var b=this;if(null!=b._cachedRange)return this._cachedRange;var d=new q.editor.dom.Range(b.document);if(E&&9>r.ie){var g=b.getIERange();if(g)try{a(g,d)}catch(k){c(d)}else c(d)}else{var l=b.getNative();if(l&&l.rangeCount)g=l.getRangeAt(0),l=l.getRangeAt(l.rangeCount-1),d.setStart(g.startContainer,g.startOffset).setEnd(l.endContainer,l.endOffset),d.collapsed&&(e.isBody(d.startContainer)&&!d.startOffset)&&c(d);else{if(this._bakRange&& e.inDoc(this._bakRange.startContainer,this.document))return this._bakRange;c(d)}}return this._bakRange=d},getStart:function(){if(this._cachedStartElement)return this._cachedStartElement;var a=E?this.getIERange():this.getRange(),b,d;if(E){if(!a)return this.document.body.firstChild;if(a.item)return a.item(0);b=a.duplicate();0r.version?"":"")+""+(b.iframeCssUrl?"":"")+(b.initialStyle? "":"")+"