Sys.Extended.UI.HtmlEditor.MSIE_list=function(e){function t(){if(null!=o){var e;for(e=o.cloneNode(!1),o.parentNode.insertBefore(e,o);o.firstChild!=s[0];)e.appendChild(o.firstChild);if(null==e.firstChild&&e.parentNode.removeChild(e),o.tagName.toUpperCase()==h)for(var t=0;tx?u.parentNode.removeChild(u):N.appendChild(u),"BR"==S&&E==f.length-1&&(e(),N=null),u==r[1]&&E==f.length-1&&(e(),N=null)}else N&&N.firstChild&&e(),null==N&&(N=d._doc.createElement("LI"),c.appendChild(N)),N.appendChild(u),e()}N&&N.firstChild&&e()}if(null!=c){for(var I=[],E=0;E0&&(m[0].parentNode!=i&&(a.length>0&&l(),a=[],i=m[0].parentNode),a.push(m))}a.length>0&&l(),null!=o&&t(),this.setSelectionAfterOperation(r,p)},Sys.Extended.UI.HtmlEditor.MSIE_justify=function(e,t,l){function n(e){null!=e&&(1!=e.childNodes||e.firstChild!=a[0]&&e.firstChild!=a[1]||(e.parentNode.insertBefore(e.firstChild,e),e.parentNode.removeChild(e)))}function r(){var t,l=d.firstChild,r=d.lastChild,i=!1;if(d.tagName&&!Sys.Extended.UI.HtmlEditor.isInlineElement(d)&&o[0][0]==l&&o[o.length-1][o[o.length-1].length-1]==r&&(t=d.tagName.toUpperCase(),"TD"!=t&&"TH"!=t&&"FIELDSET"!=t&&"LEGEND"!=t&&(i=!0)),i){var f="";if(d.getAttribute("align")&&d.getAttribute("align").length>0&&(f=d.getAttribute("align")),d.align&&d.align.length>0&&(f=d.align),d.style.textAlign&&d.style.textAlign.length>0&&(f=d.style.textAlign),d.align="",d.setAttribute("align",""),d.removeAttribute("align"),("DIV"==t||"P"==t||Sys.Extended.UI.HtmlEditor.isHeader(d))&&"left"==e&&h)s.tryUnWrap(d,a,h)&&(m=!0);else{if("remain"!=e&&("left"!=e||!h||"LI"==t&&d.parentNode.style.textAlign.length>0?d.style.textAlign=e:d.style.textAlign=""),h&&(d.style.margin="P"==t?"0px":""),"LI"==t){for(var E=d.parentNode,N=[],c=0;cL&&(!p||null!=H.nextSibling&&H.nextSibling==a[1])?H.parentNode.removeChild(H):I.appendChild(H),"BR"!=T||u!=_.length-1||p||(n(I),I=null),H==a[1]&&u==_.length-1&&(n(I),I=null)}}else{if(n(I),I=null,"remain"!=e&&("TABLE"==T||h||(H.style.textAlign=e)),h&&(H.style.margin="P"==T?"0px":""),"UL"==T||"OL"==T||"DL"==T){for(var A=0;A0?H.style.textAlign=e:H.style.textAlign=""),h&&(H.style.margin="P"==T?"0px":"");for(var E=H.parentNode,N=[],c=0;c0&&(E[0].parentNode!=d&&(o.length>0&&r(),o=[],d=E[0].parentNode),o.push(E))}o.length>0&&r(),this.setSelectionAfterOperation(a,m)},Sys.Extended.UI.HtmlEditor.MSIE_indent=function(e){function t(e){if(1==e.nodeType){var t=h.rtlState()?e.style.marginRight:e.style.marginLeft;if(t.length>0)return parseInt(t)}return 0}function l(e,t){1==e.nodeType&&("P"==e.tagName.toUpperCase()&&""==t&&(t="0px"),h.rtlState()?e.style.marginRight=t:e.style.marginLeft=t)}function n(n){e?l(n,t(n)+40+"px"):"P"==n.tagName.toUpperCase()?t(n)>=40?l(n,t(n)-40+"px"):l(n,"0px"):t(n)>40?l(n,t(n)-40+"px"):l(n,"")}function r(e){null!=e&&(1!=e.childNodes||e.firstChild!=d[0]&&e.firstChild!=d[1]||(e.parentNode.insertBefore(e.firstChild,e),e.parentNode.removeChild(e)))}function i(){var i=o.firstChild,a=o.lastChild;if(o.tagName&&!Sys.Extended.UI.HtmlEditor.isInlineElement(o)&&s[0][0]==i&&s[s.length-1][s[s.length-1].length-1]==a){var g="";o.getAttribute("align")&&o.getAttribute("align").length>0&&(g=o.getAttribute("align")),o.align&&o.align.length>0&&(g=o.align),o.style.textAlign&&o.style.textAlign.length>0&&(g=o.style.textAlign),("left"==g.toLowerCase()&&!h.rtlState()||"right"==g.toLowerCase()&&h.rtlState())&&(g=""),o.align="",o.setAttribute("align",""),o.removeAttribute("align"),n(o);var m=o.tagName.toUpperCase();if("DIV"!=m&&"P"!=m&&!Sys.Extended.UI.HtmlEditor.isHeader(o)||""!=g){if(""!=g||"LI"==m&&o.parentNode.style.textAlign.length>0?o.style.textAlign=g:o.style.textAlign="","LI"==m){for(var f=o.parentNode,E=[],N=0;N_?x.parentNode.removeChild(x):S.appendChild(x),"BR"==I&&u==C.length-1&&(r(S),S=null),x==d[1]&&u==C.length-1&&(r(S),S=null)}}else{if(r(S),S=null,n(x),"UL"==I||"OL"==I||"DL"==I){for(var H=0;H0&&(m[0].parentNode!=o&&(s.length>0&&i(),s=[],o=m[0].parentNode),s.push(m))}s.length>0&&i(),this.setSelectionAfterOperation(d,p)},Sys.Extended.UI.HtmlEditor.getSelectionAfterOperation=function(e){if(0==e.length)return[];var t=this._doc.createElement("SPAN"),l=this._doc.createElement("SPAN"),n=e[0][0],r=e[e.length-1][e[e.length-1].length-1];if(n==r&&1==r.nodeType&&0==r.childNodes.length&&Sys.Extended.UI.HtmlEditor.canHaveChildren(r))r.appendChild(t),r.appendChild(l);else{var i=Sys.Extended.UI.HtmlEditor._getReallyFirst(n);if(i.parentNode.insertBefore(t,i),i==n){var a=[];a.push(t);for(var d=0;d
";this.insertHTML(t);var l=this._doc.getElementById(Sys.Extended.UI.HtmlEditor.smartClassName+"_ll"),n=this._doc.getElementById(Sys.Extended.UI.HtmlEditor.smartClassName+"_rr"),r=this._TcurrentFormat;this._TcurrentFormat=null,this.setSelectionAfterOperation([l,n],!1),this._TcurrentFormat=r,e=this.getPseudoP()}catch(e){}return e},Sys.Extended.UI.HtmlEditor.getPseudoP=function(){var e=[];try{var t=this._getSelection(),l=this._createRange(t),n=Sys.Extended.UI.HtmlEditor.smartClassName+"_right",r=Sys.Extended.UI.HtmlEditor.smartClassName+"_left",i=null,a=null;Sys.Extended.UI.HtmlEditor.isIE?"control"!=t.type.toLowerCase()&&(i=l.duplicate(),a=l.duplicate(),i.setEndPoint("EndToStart",l),a.setEndPoint("StartToEnd",l)):(i=l.cloneRange(),a=l.cloneRange(),i.setEnd(i.startContainer,i.startOffset),a.setStart(a.endContainer,a.endOffset));var d=null,o=null;if(Sys.Extended.UI.HtmlEditor.isIE&&"control"==t.type.toLowerCase()){var s,h=l.item(0);s=this._doc.createElement("SPAN"),s.id=r,h.parentNode.insertBefore(s,h),s=this._doc.createElement("SPAN"),s.id=n,null==h.nextSibling?h.parentNode.appendChild(s):h.parentNode.insertBefore(s,h.nextSibling)}else{if(!this.insertHTML("",a))return[];if(!this.insertHTML("",i)){var p=this._doc.getElementById(n);return null!=p&&(N=p.parentNode,N.removeChild(p)),[]}}if(d=this._doc.getElementById(r),o=this._doc.getElementById(n),null!=d&&null!=o)for(;null==d.nextSibling;)d.parentNode.nextSibling?d.parentNode.parentNode.insertBefore(d,d.parentNode.nextSibling):d.parentNode.parentNode.appendChild(d);if(null!=d&&null!=o){for(;null==o.previousSibling;)o.parentNode.parentNode.insertBefore(o,o.parentNode);if(1==o.previousSibling.nodeType){var g=o.previousSibling.tagName.toUpperCase();if("BR"!=g&&"IMG"!=g){var m=Sys.Extended.UI.HtmlEditor._getReallyLast(o.previousSibling);1==m.nodeType&&Sys.Extended.UI.HtmlEditor.canHaveChildren(m)?m.appendChild(o):m.parentNode.appendChild(o)}}o.previousSibling&&1==o.previousSibling.nodeType&&"BR"==o.previousSibling.tagName.toUpperCase()&&o.parentNode.insertBefore(o,o.previousSibling)}if(null==d){var f=this._doc.createElement("SPAN");f.id=r,o.parentNode.insertBefore(f,o),d=f}if(null==o){var f=this._doc.createElement("SPAN");f.id=n,d.nextSibling?d.parentNode.insertBefore(f,d.nextSibling):d.parentNode.appendChild(f),o=f}for(null!=d&&null!=o&&(d.parentNode==o?o.parentNode.insertBefore(d,o):o.parentNode==d&&(null!=d.nextSibling?d.parentNode.insertBefore(o,d.nextSibling):d.parentNode.appendChild(o)));null!=d.nextSibling&&3==d.nextSibling.nodeType&&0==(""+d.nextSibling.data).length;)d.parentNode.removeChild(d.nextSibling);if(null==this._TcurrentFormat&&null!=d&&null!=o&&d.nextSibling==o){var E=o.parentNode;for(this._TcurrentFormat=null;E&&"BODY"!=E.tagName.toUpperCase()&&Sys.Extended.UI.HtmlEditor.isStyleTag(E.tagName);){if("A"!=E.tagName.toUpperCase()){var N=E.cloneNode(!1);null==this._TcurrentFormat?this._TcurrentFormat=N:(N.appendChild(this._TcurrentFormat),this._TcurrentFormat=N)}E=E.parentNode}if(this._TcurrentFormat){var c=this._doc.createElement("span");c.appendChild(this._TcurrentFormat),this._TcurrentFormat=c.innerHTML}}for(var y=d;y&&y.tagName&&Sys.Extended.UI.HtmlEditor.isStyleTag(y.tagName)&&"A"!=y.tagName.toUpperCase();)y=y.parentNode;for(null!=y&&"P"==y.tagName.toUpperCase()?null!=y.firstChild?y.insertBefore(d,y.firstChild):y.appendChild(d):Sys.Extended.UI.HtmlEditor.positionInParagraph(d,d.previousSibling,!0,d.parentNode),y=o;y&&y.tagName&&Sys.Extended.UI.HtmlEditor.isStyleTag(y.tagName)&&"A"!=y.tagName.toUpperCase();)y=y.parentNode;null!=y&&"P"==y.tagName.toUpperCase()?y.appendChild(o):Sys.Extended.UI.HtmlEditor.positionInParagraph(o,o.nextSibling,!1,o.parentNode),e=this.getPseudoP_Recur(d,o,0);var u=d.parentNode.tagName.toUpperCase();if(0!=e.length||null!=d.previousSibling||null!=o.nextSibling||d.nextSibling!=o||"P"!=u&&"DIV"!=llpTagName&&"LI"!=u||(e=[[d.parentNode]]),Sys.Extended.UI.HtmlEditor.isIE){t.empty(),t=this._getSelection();var v=this._createRange(t),S=this._createRange(t);try{null!=d&&v.moveToElementText(d),null!=o&&S.moveToElementText(o),null!=d&&null!=o?(v.setEndPoint("EndToEnd",S),v.select()):null!=d?v.select():null!=o&&S.select()}catch(e){}}null!=d&&d.parentNode.removeChild(d),null!=o&&o.parentNode.removeChild(o)}catch(e){for(var C=this._doc.getElementsByTagName("SPAN"),x=[],I=0;I0){var U=new RegExp(Sys.Extended.UI.HtmlEditor.smartClassName,"ig");U.test(f.id)&&x.push(f)}}for(var I=0;I0&&(r[o]=s,o++,s=[],h=0),s[h]=E,r[o]=s,o++,s=[],h=0;else{var c=E.tagName?E.tagName.toUpperCase():null;if("TABLE"==c||"TBODY"==c){for(var y=E;"TABLE"!=y.tagName.toUpperCase();)y=y.parentNode;for(var u=0,v=0,S=y.rows.item(y.rows.length-1).cells.length-1,C=y.rows.length-1,x=0;x=0&&(u=U,v=x),Sys.Extended.UI.HtmlEditor._lookChild(_,f)>=0&&(S=U,C=x)}for(var x=v;x<=C;x++)for(var U=x==v?u:0;U<=(x==C?S:y.rows.item(x).cells.length-1);U++){var _=y.rows.item(x).cells.item(U);h>0&&(r[o]=s,o++,s=[],h=0);var H=Sys.Extended.UI.HtmlEditor._lookChild(_,m)>=0,T=Sys.Extended.UI.HtmlEditor._lookChild(_,f)>=0;if(H||T){var b=m,L=f,A=Sys.Extended.UI.HtmlEditor.smartClassName+"_right_"+l,B=Sys.Extended.UI.HtmlEditor.smartClassName+"_left_"+l;H&&(L=this._doc.createElement("span"),L.id=A,_.appendChild(L)),T&&(b=this._doc.createElement("span"),b.id=B,_.firstChild?_.insertBefore(b,_.firstChild):_.appendChild(b));for(var P=this.getPseudoP_Recur(b,L,l+1),R=0;R0&&(r[o]=s,o++,s=[],h=0)}}}else if("UL"==c||"OL"==c||"DL"==c){for(var O=E,z=0,V=O.childNodes.length-1,x=0;x=0)&&(z=x),(W==f||Sys.Extended.UI.HtmlEditor._lookChild(W,f)>=0)&&(V=x))}for(var x=z;x<=V;x++){var W=O.childNodes.item(x);h>0&&(r[o]=s,o++,s=[],h=0);var H=Sys.Extended.UI.HtmlEditor._lookChild(W,m)>=0,T=Sys.Extended.UI.HtmlEditor._lookChild(W,f)>=0;if(H||T){var b=m,L=f,A=Sys.Extended.UI.HtmlEditor.smartClassName+"_right_"+l,B=Sys.Extended.UI.HtmlEditor.smartClassName+"_left_"+l;H&&(L=this._doc.createElement("span"),L.id=A,W.appendChild(L)),T&&(b=this._doc.createElement("span"),b.id=B,W.firstChild?W.insertBefore(b,W.firstChild):W.appendChild(b));for(var P=this.getPseudoP_Recur(b,L,l+1),R=0;R0&&(r[o]=s,o++,s=[],h=0)}}}else{var H=Sys.Extended.UI.HtmlEditor._lookChild(E,m)>=0,T=Sys.Extended.UI.HtmlEditor._lookChild(E,f)>=0;if(h>0&&(r[o]=s,o++,s=[],h=0),H||T){var b=m,L=f,A=Sys.Extended.UI.HtmlEditor.smartClassName+"_right_"+l,B=Sys.Extended.UI.HtmlEditor.smartClassName+"_left_"+l;H&&(L=this._doc.createElement("span"),L.id=A,E.appendChild(L)),T&&(b=this._doc.createElement("span"),b.id=B,E.firstChild?E.insertBefore(b,E.firstChild):E.appendChild(b));for(var P=this.getPseudoP_Recur(b,L,l+1),R=0;R0&&(r[o]=s,o++,s=[],h=0)}}}else{if(E.nodeType&&3==E.nodeType){var M=""+E.data;if(0==M.length||/^[\n\r]+$/.test(M)){var Y=E.nextSibling;if(E.parentNode.removeChild(E),E==a)break;E=Y;continue}}s[h]=E,h++}}if(E==a)break;E=E.nextSibling}h>0&&(r[o]=s)}return r},Sys.Extended.UI.HtmlEditor.unWrap=function(e,t){var l=this;if(e.firstChild){for(;e.firstChild&&3==e.firstChild.nodeType&&""+e.firstChild.data=="";)e.removeChild(e.firstChild);for(var n=[];e.firstChild;)e.firstChild!=t[0]&&e.firstChild!=t[1]&&n.push(e.firstChild),e.parentNode.insertBefore(e.firstChild,e);if(0==n.length){var r=l._doc.createElement("BR");e.parentNode.insertBefore(r,e)}if(Sys.Extended.UI.HtmlEditor.isIE&&1==n.length&&3==n[0].nodeType){var i=""+n[0].data;if(1==i.length&&160==i.charCodeAt(0)){var r=l._doc.createElement("BR");n[0].parentNode.insertBefore(r,n[0]),n[0].parentNode.removeChild(n[0])}}for(;e.nextSibling&&3==e.nextSibling.nodeType&&""+e.nextSibling.data=="";)e.parentNode.removeChild(e.nextSibling);var a=e.previousSibling&&t[1]==e.previousSibling?t[1].previousSibling:e.previousSibling;if(a&&Sys.Extended.UI.HtmlEditor.isInlineElement(a)&&1==a.nodeType&&a.childNodes.length>0&&(a=Sys.Extended.UI.HtmlEditor._getReallyLast(a)),Sys.Extended.UI.HtmlEditor.isInlineElement(a)&&null!=e.nextSibling){var r=l._doc.createElement("BR");e.parentNode.insertBefore(r,e)}}else{var r=l._doc.createElement("BR");e.parentNode.insertBefore(r,e)}e.parentNode.removeChild(e)},Sys.Extended.UI.HtmlEditor.tryUnWrap=function(e,t,l){var n=this;e.style.textAlign="";for(var r=0,i=e.attributes,a=0;a0&&"transparent"!=r)return r;n=n.parentNode}return"#FFFFFF"}var i="none";switch(e.toLowerCase()){case"forecolor":i="color";break;case"fontname":i="font-family";break;case"fontsize":i="font-size"}var a;if("font-size"!=i&&"font-family"!=i||!this._FontNotSet){if(a=Sys.Extended.UI.HtmlEditor.getStyle(l.start,i).toLowerCase(),"font-size"==i&&!Sys.Extended.UI.HtmlEditor.isIE){a=Sys.Extended.UI.HtmlEditor._TryTransformFromPxToPt(a,this,t);for(var d=l.start;null!=d;){if(d.style&&d.style.fontSize&&d.style.fontSize.length>0){a=d.style.fontSize;break}if(d.className&&d.className.length>0)break;var o=d.tagName.toUpperCase();if("BODY"==o||"TD"==o)break;d=d.parentNode}}}else{a="";for(var d=l.start;null!=d;){if("font-size"==i){if(d.style&&d.style.fontSize&&d.style.fontSize.length>0){a=d.style.fontSize;break}if(d.tagName&&"FONT"==d.tagName.toUpperCase()&&d.size&&d.size.length>0){a=Sys.Extended.UI.HtmlEditor.fontSizeSeek(d.size);break}}else{if(d.style&&d.style.fontFamily&&d.style.fontFamily.length>0){a=d.style.fontFamily;break}if(d.tagName&&"FONT"==d.tagName.toUpperCase()&&d.face&&d.face.length>0){a=d.face;break}}if(d.className&&d.className.length>0){a=Sys.Extended.UI.HtmlEditor.getStyle(d,i).toLowerCase(),"font-size"==i&&(Sys.Extended.UI.HtmlEditor.isIE||(a=Sys.Extended.UI.HtmlEditor._TryTransformFromPxToPt(a,this,t)));break}var o=d.tagName.toUpperCase();if("BODY"==o||"TD"==o)break;d=d.parentNode}}if(null!=this._StyleForTyping&&this._StyleForTyping.length>0)for(var s=0;s