Type.registerNamespace("Sys.Extended.UI.HtmlEditor"),Sys.Extended.UI.HtmlEditor.DesignPanel=function(e){Sys.Extended.UI.HtmlEditor.DesignPanel.initializeBase(this,[e]),this._doc=null,this._updated_now=!1,this._updateTimer=null,this._popup=null,this._contextElement=null,this._a_prize=!1,this.__stack=null,this._StyleForTyping=null,this.isWord=!1,this.isPlainText=!1,this.dfltBlockElement="P",this._FontNotSet=!0,this._design_timer1=null,this._events$delegate=Function.createDelegate(this,Sys.Extended.UI.HtmlEditor.DesignPanelEventHandler),this._blur$delegate=Function.createDelegate(this,this._blur),this._focus$delegate=Function.createDelegate(this,this._focus_event)},Sys.Extended.UI.HtmlEditor.DesignPanel.prototype={initialize:function(){Sys.Extended.UI.HtmlEditor.DesignPanel.callBaseMethod(this,"initialize")},dispose:function(){Sys.Extended.UI.HtmlEditor.DesignPanel.callBaseMethod(this,"dispose")},_activate:function(e){Sys.Extended.UI.HtmlEditor.DesignPanel.callBaseMethod(this,"_activate"),this._wasFocused=!1,this._initIframe(e),this._onDocumentLoaded()},_deactivate:function(){this._deactivateCommon(),Sys.Extended.UI.HtmlEditor.isIE&&(this._doc.open(),this._doc.write(""),this._doc.close(),this.get_element().src="javascript:false;"),this._doc=null,Sys.Extended.UI.HtmlEditor.DesignPanel.callBaseMethod(this,"_deactivate")},_deactivateCommon:function(){this._editPanel.__blured=!1;for(var e=this._doc.body.getElementsByTagName("IMG"),t=0;t0)try{Sys.Extended.UI.HtmlEditor.isIE?$removeHandler(e[t],"dragstart",Sys.Extended.UI.HtmlEditor.stopDrag):$removeHandler(e[t],"draggesture",Sys.Extended.UI.HtmlEditor.stopDrag)}catch(e){}Sys.Extended.UI.HtmlEditor._removeEvents(this._doc,["keydown","keypress","mousedown","mouseup","dblclick"],this._events$delegate),Sys.Extended.UI.HtmlEditor._removeEvents(this.get_element().contentWindow,["blur"],this._blur$delegate),Sys.Extended.UI.HtmlEditor._removeEvents(this.get_element().contentWindow,["focus"],this._focus$delegate)},_initIframe:function(e){Sys.Extended.UI.HtmlEditor.isIE||(this._savedValue=e,this._absAndFixedParents=this._getAbsAndFixedParents());var t=Sys.Extended.UI.HtmlEditor.Trim(this._prepareContent(e));this._doc=this.get_element().contentWindow.document,Sys.Extended.UI.HtmlEditor.isIE||(this._doc.designMode="on"),this._doc.open(),this._doc.write(''+t+""),this._doc.close(),this._doc.id="EditorDocument",Sys.Extended.UI.HtmlEditor.isIE&&(this._doc.body.contentEditable=!0,this._tryForward=!0)},_blur:function(e){return this._editPanel.__blured=!0,Sys.Extended.UI.HtmlEditor.isIE||null==this._design_timer1||(clearTimeout(this._design_timer1),this._design_timer1=null),this.isPopup||this._editPanel._validate(e,null),!0},_focus_event:function(){if(this._editPanel.__blured=!1,Sys.Extended.UI.HtmlEditor.isIE)this._really_focused();else{var e=this;Sys.Extended.UI.HtmlEditor.LastFocusedEditPanel=this._editPanel,null==this._design_timer1&&(this._design_timer1=setTimeout(function(){e._really_focused(),e._design_timer1=null},0))}return!0},_getAbsAndFixedParents:function(){for(var e=this.get_element(),t="";null!=e&&e.tagName&&"body"!=e.tagName.toLowerCase();)t+=e.tagName,"absolute"!=e.style.position&&"fixed"!=e.style.position||(t+=": "+e.style.position),t+="\n",e=e.parentNode;return t},_onDocumentLoaded:function(){var e=this;if(!Sys.Extended.UI.HtmlEditor.isIE){var t=this._getAbsAndFixedParents();if(t!=this._absAndFixedParents)return this._initIframe(this._savedValue),void setTimeout(function(){e._onDocumentLoaded()},10)}try{if(!Sys.Extended.UI.HtmlEditor.isIE&&(this._doc.queryCommandValue("forecolor"),(Sys.Extended.UI.HtmlEditor.isSafari||Sys.Extended.UI.HtmlEditor.isOpera)&&!Sys.Extended.UI.HtmlEditor.isReallyVisible(this.get_element())))return void setTimeout(function(){e._onDocumentLoaded()},10);e._doc.body.innerHTML}catch(t){return void setTimeout(function(){e._onDocumentLoaded()},10)}this._afterBodyIsFormed(),setTimeout(function(){e._activateFinished(),Sys.Extended.UI.HtmlEditor.isIE&&!e._editPanel.get_autofocus()&&e._getSelection().empty()},0)},_afterBodyIsFormed:function(){var e=this;Sys.Extended.UI.HtmlEditor._addEvents(this._doc,["keydown","keypress","mousedown","mouseup","dblclick"],this._events$delegate),Sys.Extended.UI.HtmlEditor._addEvents(this.get_element().contentWindow,["blur"],this._blur$delegate),Sys.Extended.UI.HtmlEditor._addEvents(this.get_element().contentWindow,["focus"],this._focus$delegate),Sys.Extended.UI.HtmlEditor.inspectForShadows(e._doc.body);var t=this._doc.body;if(1==t.childNodes.length&&t.firstChild.tagName&&"DIV"==t.firstChild.tagName.toUpperCase()&&t.firstChild.style.cssText.length>0&&t.firstChild.style.direction.length>0&&"absolute"!=Sys.Extended.UI.HtmlEditor.getStyle(t.firstChild,"position")){t.style.cssText=t.firstChild.style.cssText;for(var i=t.firstChild;i.firstChild;)t.insertBefore(i.firstChild,i);t.removeChild(i)}e._clearP()},_getContent:function(){if(null!=this._popup&&"function"==typeof this._popup._forceImClose){var e=this._popup._forceImClose;e(this._popup._iframe.contentWindow)}this._clearP();var t;if(Sys.Extended.UI.HtmlEditor.isIE){Sys.Extended.UI.HtmlEditor.spanJoiner(this._doc.body,this._doc),t=Sys.Extended.UI.HtmlEditor.getHTML(this._doc.body,!1,!0),t=t.replace(/(]*?>)([\s ]*?)(<\/td[^>]*?>)/gi,"$1 $3").replace(/(]*?>)\s*( )\s*(<\/td[^>]*?>)/gi,"$1
$3").replace(/(]*?>)\s*( )\s*(<\/p[^>]*?>)/gi,"$1
$3"),t=(this._doc.body.style.cssText.length>0?'
':"")+t+(this._doc.body.style.cssText.length>0?"
":""),this._editPanel.get_noScript()&&(t=t.replace(/(]*?)>(?:[^<]*?)<\/script(?:[^>]*?)>)/gi,"")),/)/gi,"$1$3").replace(/()/gi,"$1$3").replace(/()/gi,"$1$3").replace(/()/gi,"$1$3").replace(/()/gi,"$1$3").replace(/()/gi,"$1$3").replace(/()/gi,"$1$3").replace(/()/gi,"$1wmode=$3$4").replace(/()/gi,"$1$3"));var i=new RegExp("(<[/]?)(teo"+Sys.Extended.UI.HtmlEditor.smartClassName+":)","ig");t=t.replace(i,"$1")}else{var n=this._doc.createElement("DIV"),r=new Sys.Extended.UI.HtmlEditor.DesignPanel.ScriptRecover;n.style.cssText=this._doc.body.style.cssText,this._editPanel.get_noScript()||this._doc.body.innerHTML.replace(/]*?)>(.*?)<\/script(?:[^>]*?>)/gi,function(e,t){return r.regReplScript1(e,t)}),n.innerHTML=Sys.Extended.UI.HtmlEditor.Trim(this._doc.body.innerHTML);for(var s=n.getElementsByTagName("IMG"),d=[],o=0;o0&&"embed"==l.toLowerCase()){var h=c.getAttribute("dummysrc"),m=c.getAttribute("dummybgcolor"),g=c.getAttribute("pseudomode"),_=c.attributes,p=this._doc.createElement("EMBED");p.src=h,p.width=c.width,p.height=c.height,m&&m.length>0&&(m=Sys.Extended.UI.HtmlEditor.tryReplaceRgb(m),p.setAttribute("bgcolor",m)),g&&g.length>0&&p.setAttribute("wmode",g);for(var o=0;o<_.length;++o){var E=_.item(o);if(E.specified){var u=E.name.toLowerCase(),f=E.value;"dummytag"!=u&&"dummysrc"!=u&&"dummybgcolor"!=u&&"style"!=u&&"wmode"!=u&&"pseudomode"!=u&&"src"!=u&&("loop"==u&&"true"==f||"play"==u&&"true"==f||"hspace"==u&&"0"==f||"vspace"==u&&"0"==f||"scale"==u&&0==f.length||"align"==u&&0==f.length||p.setAttribute(u,f))}}c.style.width&&c.style.width.length>0&&(p.style.width=c.style.width),c.style.height&&c.style.height.length>0&&(p.style.height=c.style.height),c.parentNode.insertBefore(p,c),c.parentNode.removeChild(c)}}Sys.Extended.UI.HtmlEditor.spanJoiner(n,this._doc),t=Sys.Extended.UI.HtmlEditor.getHTML(n,n.style.cssText.length>0,!0),t=this._editPanel.get_noScript()?t.replace(/(]*?)>(?:[^<]*?)<\/script(?:[^>]*?)>)/gi,""):t.replace(/(]*?)>)(.*?)(<\/script(?:[^>]*?)>)/gi,function(e,t,i,n){return r.regReplFromScript1(e,t,i,n)}),delete n}return t=Sys.Extended.UI.HtmlEditor.brXHTML(t.replace(/^([\n|\r]+)/,"")),this._editPanel.get_noUnicode()&&(t=t.replace(/([\u0080-\uFFFF])/g,function(e,t){return"&#"+t.charCodeAt(0).toString(10)+";"})),"
"==Sys.Extended.UI.HtmlEditor.Trim(t)&&(t=""),t},_setContent:function(e){this._deactivateCommon();var t=Sys.Extended.UI.HtmlEditor.Trim(this._prepareContent(e));this._doc.open(),this._doc.write(''+t+""),this._doc.close(),Sys.Extended.UI.HtmlEditor.isIE&&(this._doc.body.contentEditable=!0,this._tryForward=!0),this._afterBodyIsFormed(),this._editPanel.get_autofocus()&&this._focus(),Sys.Extended.UI.HtmlEditor.isIE&&!this._editPanel.get_autofocus()&&this._getSelection().empty()},_focus:function(e){this.focusEditor(),this._focused(e)},focusEditor:function(){try{this.get_element().contentWindow.focus()}catch(e){}this._wasFocused||(this._wasFocused=!0,this._editPanel.get_startEnd()||this._setToEnd())},_prepareContent:function(e){var t=e;if(t=t.replace(/]*?)>(?:[^\u0000]*?)(]*?)>)(?:[^\u0000]*?)<\/object(?:[^>]*?)>/gi,"$1"),Sys.Extended.UI.HtmlEditor.isIE)return t=Sys.Extended.UI.HtmlEditor.Trim(t.replace(/([\n\r]+<)/g,"<").replace(/([^>])([\n\r]+)([^<])/g,"$1 $3")).replace(/(&)/g,"&amp;").replace(/\s*<\/td>/gi,"").replace(/(]*?>)([\s ]*?)(<\/td[^>]*?>)/gi,"$1 $3").replace(/(]*?>)\s*(]*?>)\s*(<\/p[^>]*?>)/gi,"$1 $3"),/)/gi,"$1pseudomode=$3$4").replace(/(]*?>)/gi,'$1 wmode="transparent"$2')),t=t.replace(/&/gi,"&");var i=new Sys.Extended.UI.HtmlEditor.DesignPanel.ScriptRecover,n=document.createElement("DIV");this._editPanel.get_noScript()||t.replace(/]*?)>(.*?)<\/script(?:[^>]*?>)/gi,function(e,t){return i.regReplScript1(e,t)}),n.innerHTML=Sys.Extended.UI.HtmlEditor.Trim(t.replace(/([^>])([\n\r]+)([^<])/g,"$1 $3"));for(var r=n.getElementsByTagName("EMBED"),s=[],d=0;d0&&(l.style.width=a.style.width),a.style.height&&a.style.height.length>0&&(l.style.height=a.style.height),a.parentNode.insertBefore(l,a),a.parentNode.removeChild(a)}return Sys.Extended.UI.HtmlEditor.spanJoiner(n,document),t=Sys.Extended.UI.HtmlEditor.Trim(Sys.Extended.UI.HtmlEditor.getHTML(n,!1,!0)),this._editPanel.get_noScript()||(t=t.replace(/(]*?)>)(.*?)(<\/script(?:[^>]*?)>)/gi,function(e,t,n,r){return i.regReplFromScript1(e,t,n,r)})),delete n,delete i,t=Sys.Extended.UI.HtmlEditor.brXHTML(t),0==t.length&&(t="
"),t},_clearP:function(){function e(t){var i=!1;if(1==t.nodeType){var n=t.tagName.toUpperCase();if((!s||"LI"!=n)&&(Sys.Extended.UI.HtmlEditor.isRestricted(t)||"IMG"==n||"IFRAME"==n||"EMBED"==n||"SCRIPT"==n))return!0;if(t.childNodes.length>1)return!0;if(0==t.childNodes.length)return!1;i|=e(t.firstChild)}else 3==t.nodeType&&(i|=!0);return i}try{var t=this._doc.body;if(t.firstChild&&3==t.firstChild.nodeType){var i=Sys.Extended.UI.HtmlEditor.Trim(""+t.firstChild.data);0==i.length?t.removeChild(t.firstChild):i!=""+t.firstChild.data&&(t.firstChild.data=i)}if(Sys.Extended.UI.HtmlEditor.isIE&&1==t.childNodes.length&&(t=t.firstChild,1==t.nodeType)){var n=t.tagName.toLowerCase();if("p"==n||"ul"==n||"ol"==n){var r=!1,s="ul"==n||"ol"==n;1==t.childNodes.length&&(e(t.firstChild)||t.removeChild(t.firstChild)),r=!0,(r||"

 

"==t.parentNode.innerHTML.toLowerCase())&&this._doc.body.removeChild(t)}}}catch(e){}},isControl:function(){try{var e=this._getSelection();if(Sys.Extended.UI.HtmlEditor.isIE)return"control"==e.type.toLowerCase();var t=this._createRange(e),i=this._getParent(t);return 3!=i.nodeType&&t.startContainer==t.endContainer&&(!!i.tagName&&(null!=t.startContainer.childNodes.item(t.startOffset)&&((t.startOffset!=t.endOffset||!t.startContainer.childNodes.item(t.startOffset).tagName||"BR"!=t.startContainer.childNodes.item(t.startOffset).tagName.toUpperCase()&&!Sys.Extended.UI.HtmlEditor.isStyleTag(t.startContainer.childNodes.item(t.startOffset).tagName))&&(!("BODY"==i.tagName.toUpperCase()&&0==t.startOffset&&t.endOffset>0&&t.endOffset==i.childNodes.length)&&(t.startOffset!=t.endOffset||3!=t.startContainer.childNodes.item(t.startOffset).nodeType)))))}catch(e){return!0}},isPopup:function(){return null!=this._popup},_getSelection:function(){if(Sys.Extended.UI.HtmlEditor.isIE){var e=this._doc.selection;return e}this.focusEditor();var e,t,i,n=this.get_element().contentWindow;e=n.getSelection(),t=this._createRange(e),i=t.startContainer;try{for(;i&&i.nodeType;)i=i.parentNode}catch(i){this._removeAllRanges(e),t=this._createRange(e),t.setStart(this._saved_startContainer,this._saved_startOffset),t.setEnd(this._saved_startContainer,this._saved_startOffset),this._selectRange(e,t),e=n.getSelection()}return e},_createRange:function(e){if(Sys.Extended.UI.HtmlEditor.isIE)return"undefined"==typeof e?this._doc.body.createTextRange():e.createRange();if(this.focusEditor(),"undefined"==typeof e)return this._doc.createRange();try{var t=e.getRangeAt(0);return t}catch(e){return this._doc.createRange()}},toEndOfProtected:function(){var e,t=this,i=this._getSelection();try{e=this._createRange(i)}catch(e){return!1}var n;if(Sys.Extended.UI.HtmlEditor.isIE?n=Sys.Extended.UI.HtmlEditor.contentEditable(Sys.Extended.UI.HtmlEditor.getSelParent(t)):(n=Sys.Extended.UI.HtmlEditor.contentEditable(e.startContainer),null==n&&(n=Sys.Extended.UI.HtmlEditor.contentEditable(e.endContainer))),Sys.Extended.UI.HtmlEditor.isIE&&null!=n){try{e.remove(n)}catch(e){}e=t._doc.body.createControlRange(),e.add(n),e.select()}else if(!Sys.Extended.UI.HtmlEditor.isIE&&null!=n){var r,s=t._getSelection();null!=n.nextSibling&&3==n.nextSibling.nodeType?r=n.nextSibling:(r=t._doc.createTextNode(""),null!=n.nextSibling?n.parentNode.insertBefore(r,n.nextSibling):n.parentNode.appendChild(r)),t._removeAllRanges(s);var e=t._createRange(s);e.setStart(r,0),e.setEnd(r,0),t._selectRange(s,e)}return!0},_commonPaste:function(e){var t=this;if(this._saveContent(),Sys.Extended.UI.HtmlEditor.isIE)this.openWait(),setTimeout(function(){t._paste(!t._editPanel.get_noPaste()),t.closeWait()},0),Sys.Extended.UI.HtmlEditor._stopEvent(e);else if(this.isPlainText||this.isWord||this._editPanel.get_noPaste()){var i=t._getSafePlace();if(null!=i){var n=t._doc.createElement("div");n.style.display="inline",n.style.borderStyle="none",i.parentNode.insertBefore(n,i),n.appendChild(i),n.removeChild(i),n.innerHTML="xx";var r=t._getSelection(),s=t._createRange();t._removeAllRanges(r),s.setStart(n.firstChild,0),s.setEnd(n.firstChild,1),t._selectRange(r,s),t.openWait(),setTimeout(function(){var e=n.parentNode;if(n.lastChild.deleteData(n.lastChild.length-1,1),t.isWord)n.innerHTML=Sys.Extended.UI.HtmlEditor.cleanUp(n.innerHTML),Sys.Extended.UI.HtmlEditor.replaceOldTags(n,t),Sys.Extended.UI.HtmlEditor.spanJoiner(n,t._doc);else{var i=document.createElement("div");i.innerHTML=Sys.Extended.UI.HtmlEditor.cleanUp(n.innerHTML);var r=new Sys.Extended.UI.HtmlEditor.jsDocument((!0));Sys.Extended.UI.HtmlEditor.__MozillaGetInnerText(i,r),n.innerHTML=r.toString().replace(//g,">").replace(/\r/g,"").replace(/\n/g,"
").replace(/\t/g," "),delete i}for(;n.firstChild;)e.insertBefore(n.firstChild,n);var s=null,d=null;n.nextSibling&&3==n.nextSibling.nodeType&&n.previousSibling&&3==n.previousSibling.nodeType&&(s=n.nextSibling,d=n.previousSibling),e.removeChild(n);var o=null;if(null!=s&&null!=d&&(o=d.data.length,d.data=""+d.data+s.data,s.parentNode.removeChild(s)),t.isWord=!1,t.isPlainText=!1,t.closeWait(),null!=o){var a=t._getSelection(),l=t._createRange();t._removeAllRanges(a),l.setStart(d,o),l.setEnd(d,o),t._selectRange(a,l)}t.onContentChanged()},0)}else Sys.Extended.UI.HtmlEditor._stopEvent(e)}else setTimeout(function(){Sys.Extended.UI.HtmlEditor.operateAnchors(t,t._doc,!t._editPanel.get_showAnchors()),Sys.Extended.UI.HtmlEditor.operatePlaceHolders(t,t._doc,!t._editPanel.get_showPlaceHolders()),Sys.Extended.UI.HtmlEditor.inspectForShadows(t._doc.body),t._checkImages(t._doc.body),t.onContentChanged()},0)},_selectRange:function(e,t){e.addRange(t),this.focusEditor()},_selectRng:function(e){var t=this._getSelection();if(Sys.Extended.UI.HtmlEditor.isIE){var i=this._createRange(t),n=this._createRange(t),r=this._doc.createElement("span"),s=this._doc.createElement("span");e[0].parentNode.insertBefore(r,e[0]),e[e.length-1].nextSibling?e[e.length-1].parentNode.insertBefore(s,e[e.length-1].nextSibling):e[e.length-1].parentNode.appendChild(s);try{i.moveToElementText(r);var d=i.moveStart("character",1);i.moveStart("character",-d),n.moveToElementText(s),d=n.moveEnd("character",-1),n.moveEnd("character",-d),i.setEndPoint("EndToEnd",n),i.select()}catch(e){}e[0].parentNode.removeChild(r),e[e.length-1].parentNode.removeChild(s)}else{var o=this._doc.createRange();o.setStart(e[0],0),o.setEnd(e[e.length-1],(""+e[e.length-1].data).length),this._removeAllRanges(t),this._selectRange(t,o)}},_removeAllRanges:function(e){e.removeAllRanges()},_setToEnd:function(){var e=this;setTimeout(function(){e._setToEnd_(),e._editPanel.updateToolbar()},0)},_setToEnd_:function(){var e=this;if(Sys.Extended.UI.HtmlEditor.isIE){var t=e._getSelection(),i=e._createRange(t);return"control"!=t.type.toLowerCase()&&(i.moveEnd("textedit",1),i.collapse(!1)),i.select(),void e.focusEditor()}var n=0,r=e._doc.body,s=null;if(r.lastChild&&3==r.lastChild.nodeType)r=r.lastChild,n=(""+r.data).length;else{var d=e._doc.createTextNode("");r.lastChild&&1==r.lastChild.nodeType&&"BR"==r.lastChild.tagName.toUpperCase()?r.insertBefore(d,r.lastChild):r.appendChild(d),r=d,n=0}var t=e._getSelection();e._removeAllRanges(t);var i=e._createRange();if(i.setStart(r,n),i.setEnd(r,n),e._selectRange(t,i),null!=s&&e._doc.body.removeChild(s),e.focusEditor(),!Sys.Extended.UI.HtmlEditor.isSafari&&!Sys.Extended.UI.HtmlEditor.isOpera)try{var s=e._doc.createElement("button");s.style.width="0px",s.style.height="20px",e._doc.body.appendChild(s),s.focus(),s.blur(),e.focusEditor(),e._doc.body.removeChild(s)}catch(e){}},isShadowed:function(){if(!this.isControl())return!1;var e,t=this._getSelection(),i=this._createRange(t);if(e=Sys.Extended.UI.HtmlEditor.isIE?i.item(0):i.startContainer.childNodes.item(i.startOffset),e.tagName&&"IMG"==e.tagName.toUpperCase()&&e.getAttribute(Sys.Extended.UI.HtmlEditor.attachedIdAttribute)&&e.getAttribute(Sys.Extended.UI.HtmlEditor.attachedIdAttribute).length>0){var n=this.getAttachedElement(e);if(null!=n){if(Sys.Extended.UI.HtmlEditor.isIE)i=this._doc.body.createControlRange(),i.add(n),i.select();else try{var r=Sys.Extended.UI.HtmlEditor.__getIndex(n);t.collapseToEnd(),this._removeAllRanges(t),i=this._createRange(t),i.setStart(n.parentNode,r),i.setEnd(n.parentNode,r+1),this._selectRange(t,i)}catch(e){return!0}return!1}return!0}return!1},_ifShadow:function(){if(Sys.Extended.UI.HtmlEditor.isIE)try{this._doc.selection}catch(e){return!1}for(var e=this,t=null,i=Sys.Extended.UI.HtmlEditor.getSelParent(e);i&&(3==i.nodeType||i.tagName&&"BODY"!=i.tagName.toUpperCase());)if(3!=i.nodeType&&i.tagName){var n=i.tagName.toUpperCase();if("TABLE"==n&&i.getAttribute(Sys.Extended.UI.HtmlEditor.noContextMenuAttribute)&&"yes"==i.getAttribute(Sys.Extended.UI.HtmlEditor.noContextMenuAttribute)){t=i.rows.item(0).cells.item(0).firstChild,Sys.Extended.UI.HtmlEditor.isIE&&"P"==n&&(t=t.firstChild);break}i=i.parentNode}else i=i.parentNode;if(null!=t){var r=e._getSelection(),s=e._createRange(r);if(Sys.Extended.UI.HtmlEditor.isIE)s=e._doc.body.createControlRange(),s.add(t),s.select();else try{r.collapseToEnd(),e._removeAllRanges(r),s=e._createRange(r),s.setStart(t.parentNode,0),s.setEnd(t.parentNode,1),e._selectRange(r,s)}catch(e){}}},_saveContent:function(){var e,t,i;try{try{e=this._getSelection(),t=this._createRange(e)}catch(e){}i=new Sys.Extended.UI.HtmlEditor._Marker(this,t,e)}catch(e){return}for(this.__stack||(this.__stack=[],this.__stackPos=0);this.__stackPos]*/gi,"")+('"X"'==n?"":"align="+n)+r.replace(/\salign=[^\s>]*/gi,"")}if(this.__stack&&this.__stackPos>=0&&this.__stackPos)/gi,e),this._doc.body.innerHTML="!!!"+Sys.Extended.UI.HtmlEditor.Trim(a),this._doc.body.firstChild&&this._doc.body.removeChild(this._doc.body.firstChild),this._doc.body.firstChild&&this._doc.body.removeChild(this._doc.body.firstChild);var l=Sys.Extended.UI.HtmlEditor.getHrefsText(a);if(Sys.Extended.UI.HtmlEditor.setHrefsText(this._doc.body,l),this._editPanel.get_relativeImages()&&(l=Sys.Extended.UI.HtmlEditor.getImagesText(a),Sys.Extended.UI.HtmlEditor.setImagesText(this._doc.body,l)),Sys.Extended.UI.HtmlEditor.setNames(this._doc.body,n._nArr),Sys.Extended.UI.HtmlEditor.operateAnchors(this,this._doc,!this._editPanel.get_showAnchors()),Sys.Extended.UI.HtmlEditor.operatePlaceHolders(this,this._doc,!this._editPanel.get_showPlaceHolders()),null!=n._tree){var d,c=this._doc.body;try{for(d=n._tree.length-1;d>=0;d--)c=c.childNodes.item(n._tree[d])}catch(e){return void(this.__stackPos>0&&(this.__stackPos--,this._restoreContent(),this.__stackPos++))}try{var h=this._doc.body.createControlRange();h.add(c),h.select()}catch(e){}}else{var m=this;setTimeout(function(){try{if(m._editPanel==Sys.Extended.UI.HtmlEditor.LastFocusedEditPanel){if(t=m._getSelection(),i=m._createRange(t),"control"!=t.type.toLowerCase())try{i.moveToPoint(n._offsetLeft,n._offsetTop)}catch(e){}i.select()}}catch(e){}},0)}}else{if(Sys.Extended.UI.HtmlEditor.isOpera)this._doc.body.innerHTML=Sys.Extended.UI.HtmlEditor.Trim(n._save);else{this._doc.body.innerHTML="";for(var d=0;d=0;d--)g+=" "+n._tree[d],c=c.childNodes.item(n._tree[d]);var _=n._offset;try{i.setStart(c,_),i.setEnd(c,_)}catch(e){return void Sys.Extended.UI.HtmlEditor.inspectForShadows(this._doc.body)}try{this._selectRange(t,i)}catch(e){}}try{Sys.Extended.UI.HtmlEditor.inspectForShadows(this._doc.body)}catch(e){}}},SaveContent:function(){this._saveContent()},RestoreContent:function(){this._undo(!1)},_undo:function(e){if(this.__stack&&this.__stackPos>0){this.__stackPos==this.__stack.length&&e&&this._saveContent();do{var t=Sys.Extended.UI.HtmlEditor.Trim(this._doc.body.innerHTML);this.__stackPos--,this._restoreContent()}while(Sys.Extended.UI.HtmlEditor.Trim(this._doc.body.innerHTML)==t&&this.__stackPos>0&&e);var i=this;setTimeout(function(){try{i._ifShadow()}catch(e){}if(i._editPanel==Sys.Extended.UI.HtmlEditor.LastFocusedEditPanel)try{i._editPanel.updateToolbar()}catch(e){}e||i.onContentChanged()},0)}},_redo:function(){if(this.__stack&&this.__stackPos0)){var i=t._body.ownerDocument.createElement("div");t._body.appendChild(i),setTimeout(function(){t._body.removeChild(i)},0)}this._restoreContent();var t=this;setTimeout(function(){t._ifShadow(),t._editPanel.updateToolbar()},0)}},undo:function(){this._undo(!0),this.onContentChanged()},redo:function(){this._redo(),this.onContentChanged()},_contextMenuCallP:function(){},onContentChanged:function(){},_copyCut:function(e,t){var i=this;if(Sys.Extended.UI.HtmlEditor.isIE){var n=this._getSelection(),r=this._createRange(n),s=!1,d="";if("x"==e&&this._saveContent(),"control"==n.type.toLowerCase())s=!0,d=Sys.Extended.UI.HtmlEditor.getHTML(r.item(0),!0);else if(""!=r.text){s=!0,d=r.htmlText;var o=r.duplicate(),a=this._getTextNodeCollection();if(a.length<1)return;var l=Sys.Extended.UI.HtmlEditor._commonParent(a[0],a[a.length-1]);if(null!=l&&a[0].previousSibling&&3==a[0].previousSibling.nodeType)for(var c=l.parent;c&&"BODY"!=c.tagName.toUpperCase()&&Sys.Extended.UI.HtmlEditor.isStyleTag(c.tagName);){var h=c.cloneNode(!1);h.innerHTML=d,d=h.outerHTML,c=c.parentNode}n=this._getSelection(),n.empty(),r=this._createRange(n),r.setEndPoint("EndToEnd",o),r.setEndPoint("StartToStart",o),r.select()}else""!=r.htmlText&&(s=!0,d=r.htmlText);if(s){var m=this._doc.createElement("DIV");m.innerHTML="!!!"+d,m.removeChild(m.firstChild),m.removeChild(m.firstChild);var g=Sys.Extended.UI.HtmlEditor.getHTML(m,!1,!0),_=new RegExp("(<[/]?)(teo"+Sys.Extended.UI.HtmlEditor.smartClassName+":)","ig");g=g.replace(_,"$1"),delete m,this._contentCopy(g,!0),r.select(),"x"==e&&(n.clear(),this._clearP())}else"x"==e&&(n.clear(),this._clearP());t&&setTimeout(function(){i._editPanel.updateToolbar()},0)}else if("x"==e){this._saveContent();var n=this._getSelection(),r=this._createRange(n);this._removeAllRanges(n),r.deleteContents(),""==this._doc.body.innerHTML&&(this._doc.body.innerHTML="
",r.setStart(this._doc.body,0),r.setEnd(this._doc.body,0)),i.onContentChanged(),this._selectRange(n,r)}else{var n=this._getSelection(),r=this._createRange(n);this._removeAllRanges(n),alert(String.format(Sys.Extended.UI.Resources.HTMLEditor_toolbar_button_Use_verb,Sys.Extended.UI.HtmlEditor.isSafari&&navigator.userAgent.indexOf("mac")!=-1?"Apple-C":"Ctrl-C")),this._selectRange(n,r)}},_paste:function(e,t){var i,n,r=this,s=this._getSelection(),d=this._createRange(s);if(!e)return i=d.offsetLeft,n=d.offsetTop,this.insertHTML(this._getPlain()),void r.onContentChanged();if(!this._editPanel.get_noPaste()){i=d.offsetLeft,n=d.offsetTop;var o,a=this._doc.createElement("span"),l=this._contentCopy("",!1,t);if(/<[\/]*p[\s>]+/i.test(l)||/<[\/]*h/i.test(l))o=this._getSafePlace();else{if(o=this._doc.createElement("SPAN"),o.id=Sys.Extended.UI.HtmlEditor.smartClassName,!this.insertHTML(Sys.Extended.UI.HtmlEditor.getHTML(o,!0)))return;o=this._doc.getElementById(Sys.Extended.UI.HtmlEditor.smartClassName),o&&(o.id=null,o.removeAttribute("id"),o.setAttribute("para","no"))}if(a.innerHTML=l,o){this._checkImages(a);var c=o.parentNode,h=o.getAttribute("para");if("no"!=h){if(h.indexOf("left")>=0&&a.firstChild&&a.firstChild.tagName&&"P"==a.firstChild.tagName.toUpperCase()){for(;a.firstChild.firstChild;)o.previousSibling.appendChild(a.firstChild.firstChild);a.removeChild(a.firstChild)}if(h.indexOf("right")>=0&&a.lastChild&&a.lastChild.tagName&&"P"==a.lastChild.tagName.toUpperCase()){for(;a.lastChild.lastChild;)o.nextSibling.insertBefore(a.lastChild.lastChild,o.nextSibling.firstChild);a.removeChild(a.lastChild)}}var m=o,g=null;if(0==a.childNodes.length&&h.indexOf("left")>=0&&h.indexOf("right")>=0){for(o.nextSibling.firstChild&&(g=this._doc.createElement("span"),m=g,g.innerHTML="111",o.previousSibling.appendChild(g));o.nextSibling.firstChild;)o.previousSibling.appendChild(o.nextSibling.firstChild);c.removeChild(o.nextSibling)}else for(;a.firstChild;)c.insertBefore(a.firstChild,o);setTimeout(function(){var e=r._getSelection(),t=r._createRange(e);if("control"==e.type.toLowerCase())for(;t.length>0;)t.remove(0);try{t.collapse(!1)}catch(e){}r.focusEditor(),Sys.Extended.UI.HtmlEditor._setCursor(m,r),g&&g.parentNode.removeChild(g),c.removeChild(o),Sys.Extended.UI.HtmlEditor.inspectForShadows(r._doc.body),r.onContentChanged(),t.select()},0)}}},_contentCopy:function(e,t,i){""!=e&&(e=e.replace(/(]*?>)([\s ]*?)(<\/td[^>]*?>)/gi,"$1 $3").replace(/(]*?>)\s*( )\s*(<\/td[^>]*?>)/gi,"$1
$3").replace(/(]*?>)\s*( )\s*(<\/p[^>]*?>)/gi,"$1
$3"));var n=this._doc.createElement("iframe");n.width="0",n.height="0",Sys.Extended.UI.HtmlEditor.isIE&&(n.src="javascript:false;"),this._doc.appendChild(n);var r=n.contentWindow.document;r.write(""+e+""),r.close(),r.body.contentEditable=!0;var s=r.body.createTextRange(),d=!1;if(""==e){s.execCommand("paste");for(var o=r.createElement("DIV"),a=0;a=0&&l.nextSibling&&3==l.nextSibling.nodeType){var c=""+l.nextSibling.data;if(c.length&&160==c.charCodeAt(0)){c=c.substr(1),l.nextSibling.data=c,d=!0;break}}}}"undefined"!=typeof i&&i&&(r.body.innerHTML=Sys.Extended.UI.HtmlEditor.cleanUp(r.body.innerHTML));var c=Sys.Extended.UI.HtmlEditor.Trim(Sys.Extended.UI.HtmlEditor.getHTML(r.body,!1,!0));if(c=c.replace(/(]*?)>(?:[^<]*?)<\/script(?:[^>]*?)>)/gi,""),r.body.innerHTML=c,!t){Sys.Extended.UI.HtmlEditor.operateAnchors(this,r,!this.showAnchors),Sys.Extended.UI.HtmlEditor.operatePlaceHolders(this,r,!this.showPlaceHolders);for(var h=r.body.getElementsByTagName("EMBED"),m=[],a=0;a\s*<\/td>/gi,"").replace(/(]*?>)([\s ]*?)(<\/td[^>]*?>)/gi,"$1 $3").replace(/(]*?>)\s*(]*?>)\s*(<\/p[^>]*?>)/gi,"$1 $3").replace(/()/gi,"$1pseudomode=$3$4").replace(/(]*?>)/gi,'$1 wmode="transparent"$2'),h=r.body.getElementsByTagName("EMBED"),m=[],a=0;a