Type.registerNamespace("Sys.Extended.UI.HtmlEditor");Sys.Extended.UI.HtmlEditor.DesignPanel=function(n){Sys.Extended.UI.HtmlEditor.DesignPanel.initializeBase(this,[n]);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(n){Sys.Extended.UI.HtmlEditor.DesignPanel.callBaseMethod(this,"_activate");this._wasFocused=!1;this._initIframe(n);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(){var t,n;for(this._editPanel.__blured=!1,t=this._doc.body.getElementsByTagName("IMG"),n=0;n0)try{Sys.Extended.UI.HtmlEditor.isIE?$removeHandler(t[n],"dragstart",Sys.Extended.UI.HtmlEditor.stopDrag):$removeHandler(t[n],"draggesture",Sys.Extended.UI.HtmlEditor.stopDrag)}catch(i){}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(n){Sys.Extended.UI.HtmlEditor.isIE||(this._savedValue=n,this._absAndFixedParents=this._getAbsAndFixedParents());var t=Sys.Extended.UI.HtmlEditor.Trim(this._prepareContent(n));this._doc=this.get_element().contentWindow.document;Sys.Extended.UI.HtmlEditor.isIE||(this._doc.designMode="on");this._doc.open();this._doc.write('<\/head>'+t+"<\/body><\/html>");this._doc.close();this._doc.id="EditorDocument";Sys.Extended.UI.HtmlEditor.isIE&&(this._doc.body.contentEditable=!0,this._tryForward=!0)},_blur:function(n){return this._editPanel.__blured=!0,Sys.Extended.UI.HtmlEditor.isIE||this._design_timer1==null||(clearTimeout(this._design_timer1),this._design_timer1=null),this.isPopup||this._editPanel._validate(n,null),!0},_focus_event:function(){if(this._editPanel.__blured=!1,Sys.Extended.UI.HtmlEditor.isIE)this._really_focused();else{var n=this;Sys.Extended.UI.HtmlEditor.LastFocusedEditPanel=this._editPanel;this._design_timer1==null&&(this._design_timer1=setTimeout(function(){n._really_focused();n._design_timer1=null},0))}return!0},_getAbsAndFixedParents:function(){for(var n=this.get_element(),t="";n!=null&&n.tagName&&n.tagName.toLowerCase()!="body";)t+=n.tagName,(n.style.position=="absolute"||n.style.position=="fixed")&&(t+=": "+n.style.position),t+="\n",n=n.parentNode;return t},_onDocumentLoaded:function(){var n=this,t,i;if(!Sys.Extended.UI.HtmlEditor.isIE&&(t=this._getAbsAndFixedParents(),t!=this._absAndFixedParents)){this._initIframe(this._savedValue);setTimeout(function(){n._onDocumentLoaded()},10);return}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()))){setTimeout(function(){n._onDocumentLoaded()},10);return}i=n._doc.body.innerHTML}catch(r){setTimeout(function(){n._onDocumentLoaded()},10);return}this._afterBodyIsFormed();setTimeout(function(){n._activateFinished();Sys.Extended.UI.HtmlEditor.isIE&&!n._editPanel.get_autofocus()&&n._getSelection().empty()},0)},_afterBodyIsFormed:function(){var i=this,n,t;if(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(i._doc.body),n=this._doc.body,n.childNodes.length==1&&n.firstChild.tagName&&n.firstChild.tagName.toUpperCase()=="DIV"&&n.firstChild.style.cssText.length>0&&n.firstChild.style.direction.length>0&&Sys.Extended.UI.HtmlEditor.getStyle(n.firstChild,"position")!="absolute"){for(n.style.cssText=n.firstChild.style.cssText,t=n.firstChild;t.firstChild;)n.insertBefore(t.firstChild,t);n.removeChild(t)}i._clearP()},_getContent:function(){var p,n,w,u,a,v,s,h,t,c,f,l,i,e;if(this._popup!=null&&typeof this._popup._forceImClose=="function"&&(p=this._popup._forceImClose,p(this._popup._iframe.contentWindow)),this._clearP(),Sys.Extended.UI.HtmlEditor.isIE)Sys.Extended.UI.HtmlEditor.spanJoiner(this._doc.body,this._doc),n=Sys.Extended.UI.HtmlEditor.getHTML(this._doc.body,!1,!0),n=n.replace(/(]*?>)([\s ]*?)(<\/td[^>]*?>)/ig,"$1 $3").replace(/(]*?>)\s*( )\s*(<\/td[^>]*?>)/ig,"$1
$3").replace(/(]*?>)\s*( )\s*(<\/p[^>]*?>)/ig,"$1
$3"),n=(this._doc.body.style.cssText.length>0?'
':"")+n+(this._doc.body.style.cssText.length>0?"<\/div>":""),this._editPanel.get_noScript()&&(n=n.replace(/(]*?)>(?:[^<]*?)<\/script(?:[^>]*?)>)/gi,"")),/)/ig,"$1$3").replace(/()/ig,"$1$3").replace(/()/ig,"$1$3").replace(/()/ig,"$1$3").replace(/()/ig,"$1$3").replace(/()/ig,"$1$3").replace(/()/ig,"$1$3").replace(/()/ig,"$1wmode=$3$4").replace(/()/ig,"$1$3")),w=new RegExp("(<[/]?)(teo"+Sys.Extended.UI.HtmlEditor.smartClassName+":)","ig"),n=n.replace(w,"$1");else{for(u=this._doc.createElement("DIV"),a=new Sys.Extended.UI.HtmlEditor.DesignPanel.ScriptRecover,u.style.cssText=this._doc.body.style.cssText,this._editPanel.get_noScript()||this._doc.body.innerHTML.replace(/]*?)>(.*?)<\/script(?:[^>]*?>)/gi,function(n,t){return a.regReplScript1(n,t)}),u.innerHTML=Sys.Extended.UI.HtmlEditor.Trim(this._doc.body.innerHTML),v=u.getElementsByTagName("IMG"),s=[],f=0;f0&&c.toLowerCase()=="embed"){var k=t.getAttribute("dummysrc"),o=t.getAttribute("dummybgcolor"),y=t.getAttribute("pseudomode"),b=t.attributes,r=this._doc.createElement("EMBED");for(r.src=k,r.width=t.width,r.height=t.height,o&&o.length>0&&(o=Sys.Extended.UI.HtmlEditor.tryReplaceRgb(o),r.setAttribute("bgcolor",o)),y&&y.length>0&&r.setAttribute("wmode",y),f=0;f0&&(r.style.width=t.style.width);t.style.height&&t.style.height.length>0&&(r.style.height=t.style.height);t.parentNode.insertBefore(r,t);t.parentNode.removeChild(t)}Sys.Extended.UI.HtmlEditor.spanJoiner(u,this._doc);n=Sys.Extended.UI.HtmlEditor.getHTML(u,u.style.cssText.length>0?!0:!1,!0);n=this._editPanel.get_noScript()?n.replace(/(]*?)>(?:[^<]*?)<\/script(?:[^>]*?)>)/gi,""):n.replace(/(]*?)>)(.*?)(<\/script(?:[^>]*?)>)/gi,function(n,t,i,r){return a.regReplFromScript1(n,t,i,r)});delete u}return n=Sys.Extended.UI.HtmlEditor.brXHTML(n.replace(/^([\n|\r]+)/,"")),this._editPanel.get_noUnicode()&&(n=n.replace(/([\u0080-\uFFFF])/g,function(n,t){return"&#"+t.charCodeAt(0).toString(10)+";"})),Sys.Extended.UI.HtmlEditor.Trim(n)=="
"&&(n=""),n},_setContent:function(n){this._deactivateCommon();var t=Sys.Extended.UI.HtmlEditor.Trim(this._prepareContent(n));this._doc.open();this._doc.write('<\/head>'+t+"<\/body><\/html>");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(n){this.focusEditor();this._focused(n)},focusEditor:function(){try{this.get_element().contentWindow.focus()}catch(n){}this._wasFocused||(this._wasFocused=!0,this._editPanel.get_startEnd()||this._setToEnd())},_prepareContent:function(n){var t=n,o,e,l,s,h,r,c,f,n;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>/ig,"<\/td>").replace(/(]*?>)([\s ]*?)(<\/td[^>]*?>)/ig,"$1 $3").replace(/(]*?>)\s*(]*?>)\s*(<\/p[^>]*?>)/ig,"$1 $3"),/)/ig,"$1pseudomode=$3$4").replace(/(]*?>)/ig,'$1 wmode="transparent"$2')),t.replace(/&/ig,"&");for(o=new Sys.Extended.UI.HtmlEditor.DesignPanel.ScriptRecover,e=document.createElement("DIV"),this._editPanel.get_noScript()||t.replace(/]*?)>(.*?)<\/script(?:[^>]*?>)/gi,function(n,t){return o.regReplScript1(n,t)}),e.innerHTML=Sys.Extended.UI.HtmlEditor.Trim(t.replace(/([^>])([\n\r]+)([^<])/g,"$1 $3")),l=e.getElementsByTagName("EMBED"),s=[],r=0;r0&&(u.style.width=i.style.width);i.style.height&&i.style.height.length>0&&(u.style.height=i.style.height);i.parentNode.insertBefore(u,i);i.parentNode.removeChild(i)}return Sys.Extended.UI.HtmlEditor.spanJoiner(e,document),t=Sys.Extended.UI.HtmlEditor.Trim(Sys.Extended.UI.HtmlEditor.getHTML(e,!1,!0)),this._editPanel.get_noScript()||(t=t.replace(/(]*?)>)(.*?)(<\/script(?:[^>]*?)>)/gi,function(n,t,i,r){return o.regReplFromScript1(n,t,i,r)})),delete e,delete o,t=Sys.Extended.UI.HtmlEditor.brXHTML(t),t.length==0&&(t="
"),t},_clearP:function(){var n,i,t,r,u;try{if(n=this._doc.body,n.firstChild&&n.firstChild.nodeType==3&&(i=Sys.Extended.UI.HtmlEditor.Trim(""+n.firstChild.data+""),i.length==0?n.removeChild(n.firstChild):i!=""+n.firstChild.data+""&&(n.firstChild.data=i)),Sys.Extended.UI.HtmlEditor.isIE&&n.childNodes.length==1&&(n=n.firstChild,n.nodeType==1&&(t=n.tagName.toLowerCase(),t=="p"||t=="ul"||t=="ol"))){r=!1;u=t=="ul"||t=="ol";function f(n){var i=!1,t;if(n.nodeType==1){if((t=n.tagName.toUpperCase(),!(u&&t=="LI")&&(Sys.Extended.UI.HtmlEditor.isRestricted(n)||t=="IMG"||t=="IFRAME"||t=="EMBED"||t=="SCRIPT"))||n.childNodes.length>1)return!0;if(n.childNodes.length==0)return!1;i|=f(n.firstChild)}else n.nodeType==3&&(i|=!0);return i}n.childNodes.length==1&&(f(n.firstChild)||n.removeChild(n.firstChild));r=!0;(r||n.parentNode.innerHTML.toLowerCase()=="

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