/* Copyright (c) 2008, Yahoo! Inc. All rights reserved. Code licensed under the BSD License: http://developer.yahoo.net/yui/license.txt version: 2.6.0 */ (function(){var B=YAHOO.util.Dom,A=YAHOO.util.Event,C=YAHOO.lang;if(YAHOO.widget.Button){YAHOO.widget.ToolbarButtonAdvanced=YAHOO.widget.Button;YAHOO.widget.ToolbarButtonAdvanced.prototype.buttonType="rich";YAHOO.widget.ToolbarButtonAdvanced.prototype.checkValue=function(F){var E=this.getMenu().getItems();if(E.length===0){this.getMenu()._onBeforeShow();E=this.getMenu().getItems();}for(var D=0;D'+G+"";this._titlebar.appendChild(F);A.on(F.firstChild,"click",function(H){A.stopEvent(H);});A.on([F,F.firstChild],"focus",function(){this._handleFocus();},this,true);}if(this.get("firstChild")){this.insertBefore(this._titlebar,this.get("firstChild"));}else{this.appendChild(this._titlebar);}if(this.get("collapse")){this.set("collapse",true);}}else{if(this._titlebar){if(this._titlebar&&this._titlebar.parentNode){this._titlebar.parentNode.removeChild(this._titlebar);}}}}});this.setAttributeConfig("collapse",{value:false,method:function(H){if(this._titlebar){var G=null;var F=C.getElementsByClassName("collapse","span",this._titlebar);if(H){if(F.length>0){return true;}G=document.createElement("SPAN");G.innerHTML="X";G.title=this.STR_COLLAPSE;C.addClass(G,"collapse");this._titlebar.appendChild(G);A.addListener(G,"click",function(){if(C.hasClass(this.get("cont").parentNode,"yui-toolbar-container-collapsed")){this.collapse(false);}else{this.collapse();}},this,true);}else{G=C.getElementsByClassName("collapse","span",this._titlebar);if(G[0]){if(C.hasClass(this.get("cont").parentNode,"yui-toolbar-container-collapsed")){this.collapse(false);}G[0].parentNode.removeChild(G[0]);}}}}});this.setAttributeConfig("draggable",{value:(E.draggable||false),method:function(F){if(F&&!this.get("titlebar")){if(!this._dragHandle){this._dragHandle=document.createElement("SPAN");this._dragHandle.innerHTML="|";this._dragHandle.setAttribute("title","Click to drag the toolbar");this._dragHandle.id=this.get("id")+"_draghandle";C.addClass(this._dragHandle,this.CLASS_DRAGHANDLE);if(this.get("cont").hasChildNodes()){this.get("cont").insertBefore(this._dragHandle,this.get("cont").firstChild);}else{this.get("cont").appendChild(this._dragHandle);}this.dd=new YAHOO.util.DD(this.get("id"));this.dd.setHandleElId(this._dragHandle.id);}}else{if(this._dragHandle){this._dragHandle.parentNode.removeChild(this._dragHandle);this._dragHandle=null;this.dd=null;}}if(this._titlebar){if(F){this.dd=new YAHOO.util.DD(this.get("id"));this.dd.setHandleElId(this._titlebar);C.addClass(this._titlebar,"draggable");}else{C.removeClass(this._titlebar,"draggable");if(this.dd){this.dd.unreg();this.dd=null;}}}},validator:function(G){var F=true;if(!YAHOO.util.DD){F=false;}return F;}});},addButtonGroup:function(I){if(!this.get("element")){this._queue[this._queue.length]=["addButtonGroup",arguments];return false;}if(!this.hasClass(this.CLASS_PREFIX+"-grouped")){this.addClass(this.CLASS_PREFIX+"-grouped");}var J=document.createElement("DIV");C.addClass(J,this.CLASS_PREFIX+"-group");C.addClass(J,this.CLASS_PREFIX+"-group-"+I.group);if(I.label){var F=document.createElement("h3");F.innerHTML=I.label;J.appendChild(F);}if(!this.get("grouplabels")){C.addClass(this.get("cont"),this.CLASS_PREFIX,"-nogrouplabels");}this.get("cont").appendChild(J);var H=document.createElement("ul");J.appendChild(H);if(!this._buttonGroupList){this._buttonGroupList={};}this._buttonGroupList[I.group]=H;for(var G=0;G'+F.replace("#","")+"";}}G+="X";window.setTimeout(function(){E.innerHTML=G;},0);A.on(E,"mouseover",function(M){var K=this._colorPicker;var L=K.getElementsByTagName("em")[0];var J=K.getElementsByTagName("strong")[0];var I=A.getTarget(M);if(I.tagName.toLowerCase()=="a"){L.style.backgroundColor=I.style.backgroundColor;J.innerHTML=this._colorData["#"+I.innerHTML]+"
"+I.innerHTML;}},this,true);A.on(E,"focus",function(I){A.stopEvent(I);});A.on(E,"click",function(I){A.stopEvent(I);});A.on(E,"mousedown",function(J){A.stopEvent(J);var I=A.getTarget(J);if(I.tagName.toLowerCase()=="a"){var L=this.fireEvent("colorPickerClicked",{type:"colorPickerClicked",target:this,button:this._colorPicker._button,color:I.innerHTML,colorName:this._colorData["#"+I.innerHTML]});if(L!==false){var K={color:I.innerHTML,colorName:this._colorData["#"+I.innerHTML],value:this._colorPicker._button};this.fireEvent("buttonClick",{type:"buttonClick",target:this.get("element"),button:K});}this.getButtonByValue(this._colorPicker._button).getMenu().hide();}},this,true);},_resetColorPicker:function(){var F=this._colorPicker.getElementsByTagName("em")[0];var E=this._colorPicker.getElementsByTagName("strong")[0];F.style.backgroundColor="transparent"; E.innerHTML="";},_makeColorButton:function(E){if(!this._colorPicker){this._createColorPicker(this.get("id"));}E.type="color";E.menu=new YAHOO.widget.Overlay(this.get("id")+"_"+E.value+"_menu",{visible:false,position:"absolute",iframe:true});E.menu.setBody("");E.menu.render(this.get("cont"));C.addClass(E.menu.element,"yui-button-menu");C.addClass(E.menu.element,"yui-color-button-menu");E.menu.beforeShowEvent.subscribe(function(){E.menu.cfg.setProperty("zindex",5);E.menu.cfg.setProperty("context",[this.getButtonById(E.id).get("element"),"tl","bl"]);this._resetColorPicker();var F=this._colorPicker;if(F.parentNode){F.parentNode.removeChild(F);}E.menu.setBody("");E.menu.appendToBody(F);this._colorPicker.style.display="block";},this,true);return E;},_makeSpinButton:function(R,L){R.addClass(this.CLASS_PREFIX+"-spinbutton");var S=this,N=R._button.parentNode.parentNode,I=L.range,H=document.createElement("a"),G=document.createElement("a");H.href="#";G.href="#";H.tabIndex="-1";G.tabIndex="-1";H.className="up";H.title=this.STR_SPIN_UP;H.innerHTML=this.STR_SPIN_UP;G.className="down";G.title=this.STR_SPIN_DOWN;G.innerHTML=this.STR_SPIN_DOWN;N.appendChild(H);N.appendChild(G);var M=YAHOO.lang.substitute(this.STR_SPIN_LABEL,{VALUE:R.get("label")});R.set("title",M);var Q=function(T){T=((TI[1])?I[1]:T);return T;};var P=this.browser;var F=false;var K=this.STR_SPIN_LABEL;if(this._titlebar&&this._titlebar.firstChild){F=this._titlebar.firstChild;}var E=function(U){YAHOO.util.Event.stopEvent(U);if(!R.get("disabled")&&(U.keyCode!=9)){var V=parseInt(R.get("label"),10);V++;V=Q(V);R.set("label",""+V);var T=YAHOO.lang.substitute(K,{VALUE:R.get("label")});R.set("title",T);if(!P.webkit&&F){}S._buttonClick(U,L);}};var O=function(U){YAHOO.util.Event.stopEvent(U);if(!R.get("disabled")&&(U.keyCode!=9)){var V=parseInt(R.get("label"),10);V--;V=Q(V);R.set("label",""+V);var T=YAHOO.lang.substitute(K,{VALUE:R.get("label")});R.set("title",T);if(!P.webkit&&F){}S._buttonClick(U,L);}};var J=function(T){if(T.keyCode==38){E(T);}else{if(T.keyCode==40){O(T);}else{if(T.keyCode==107&&T.shiftKey){E(T);}else{if(T.keyCode==109&&T.shiftKey){O(T);}}}}};R.on("keydown",J,this,true);A.on(H,"mousedown",function(T){A.stopEvent(T);},this,true);A.on(G,"mousedown",function(T){A.stopEvent(T);},this,true);A.on(H,"click",E,this,true);A.on(G,"click",O,this,true);},_buttonClick:function(L,F){var E=true;if(L&&L.type=="keypress"){if(L.keyCode==9){E=false;}else{if((L.keyCode===13)||(L.keyCode===0)||(L.keyCode===32)){}else{E=false;}}}if(E){var N=true,H=false;F.isSelected=this.isSelected(F.id);if(F.value){H=this.fireEvent(F.value+"Click",{type:F.value+"Click",target:this.get("element"),button:F});if(H===false){N=false;}}if(F.menucmd&&N){H=this.fireEvent(F.menucmd+"Click",{type:F.menucmd+"Click",target:this.get("element"),button:F});if(H===false){N=false;}}if(N){this.fireEvent("buttonClick",{type:"buttonClick",target:this.get("element"),button:F});}if(F.type=="select"){var K=this.getButtonById(F.id);if(K.buttonType=="rich"){var J=F.value;for(var I=0;I'+J+"");var M=K.getMenu().getItems();for(var G=0;G(this._buttonList.length-1)){this._navCounter=0;}if(this._navCounter<0){this._navCounter=(this._buttonList.length-1);}if(this._buttonList[this._navCounter]){var E=this._buttonList[this._navCounter].get("element");if(this.browser.ie){E=this._buttonList[this._navCounter].get("element").getElementsByTagName("a")[0];}if(this._buttonList[this._navCounter].get("disabled")){this._navigateButtons(F);}else{E.focus();}}break;}},_handleFocus:function(){if(!this._keyNav){var E="keypress";if(this.browser.ie){E="keydown";}A.on(this.get("element"),E,this._navigateButtons,this,true);this._keyNav=true;this._navCounter=-1;}},getButtonById:function(G){var E=this._buttonList.length;for(var F=0;F'+H[E]._oText.nodeValue+"");}else{H[E].cfg.setProperty("checked",false); }}}}}else{return false;}},deselectButton:function(F){var E=B.call(this,F);if(E){E.removeClass("yui-button-selected");E.removeClass("yui-button-"+E.get("value")+"-selected");E.removeClass("yui-button-hover");E._selected=false;}else{return false;}},deselectAllButtons:function(){var E=this._buttonList.length;for(var F=0;F0)){var I=0;for(var G=0;G',editorDirty:null,_defaultCSS:"html { height: 95%; } body { padding: 7px; background-color: #fff; font:13px/1.22 arial,helvetica,clean,sans-serif;*font-size:small;*font:x-small; } a, a:visited, a:hover { color: blue !important; text-decoration: underline !important; cursor: text !important; } .warning-localfile { border-bottom: 1px dashed red !important; } .yui-busy { cursor: wait !important; } img.selected { border: 2px dotted #808080; } img { cursor: pointer !important; border: none; } body.ptags.webkit div { margin: 11px 0; }",_defaultToolbar:null,_lastButton:null,_baseHREF:function(){var E=document.location.href;if(E.indexOf("?")!==-1){E=E.substring(0,E.indexOf("?"));}E=E.substring(0,E.lastIndexOf("/"))+"/";return E; }(),_lastImage:null,_blankImageLoaded:null,_fixNodesTimer:null,_nodeChangeTimer:null,_lastNodeChangeEvent:null,_lastNodeChange:0,_rendered:null,DOMReady:null,_selection:null,_mask:null,_showingHiddenElements:null,currentWindow:null,currentEvent:null,operaEvent:null,currentFont:null,currentElement:null,dompath:null,beforeElement:null,afterElement:null,invalidHTML:{form:true,input:true,button:true,select:true,link:true,html:true,body:true,iframe:true,script:true,style:true,textarea:true},toolbar:null,_contentTimer:null,_contentTimerCounter:0,_disabled:["createlink","fontname","fontsize","forecolor","backcolor"],_alwaysDisabled:{undo:true,redo:true},_alwaysEnabled:{},_semantic:{"bold":true,"italic":true,"underline":true},_tag2cmd:{"b":"bold","strong":"bold","i":"italic","em":"italic","u":"underline","sup":"superscript","sub":"subscript","img":"insertimage","a":"createlink","ul":"insertunorderedlist","ol":"insertorderedlist"},_createIframe:function(){var I=document.createElement("iframe");I.id=this.get("id")+"_editor";var G={border:"0",frameBorder:"0",marginWidth:"0",marginHeight:"0",leftMargin:"0",topMargin:"0",allowTransparency:"true",width:"100%"};if(this.get("autoHeight")){G.scrolling="no";}for(var H in G){if(D.hasOwnProperty(G,H)){I.setAttribute(H,G[H]);}}var F="javascript:;";if(this.browser.ie){F="javascript:false;";}I.setAttribute("src",F);var E=new YAHOO.util.Element(I);E.setStyle("visibility","hidden");return E;},_isElement:function(F,E){if(F&&F.tagName&&(F.tagName.toLowerCase()==E)){return true;}if(F&&F.getAttribute&&(F.getAttribute("tag")==E)){return true;}return false;},_hasParent:function(F,E){if(!F||!F.parentNode){return false;}while(F.parentNode){if(this._isElement(F,E)){return F;}if(F.parentNode){F=F.parentNode;}else{return false;}}return false;},_getDoc:function(){var E=false;if(this.get){if(this.get("iframe")){if(this.get("iframe").get){if(this.get("iframe").get("element")){try{if(this.get("iframe").get("element").contentWindow){if(this.get("iframe").get("element").contentWindow.document){E=this.get("iframe").get("element").contentWindow.document;return E;}}}catch(F){}}}}}return false;},_getWindow:function(){return this.get("iframe").get("element").contentWindow;},_focusWindow:function(E){if(this.browser.webkit){if(E){this._getSelection().setBaseAndExtent(this._getDoc().body.firstChild,0,this._getDoc().body.firstChild,1);if(this.browser.webkit3){this._getSelection().collapseToStart();}else{this._getSelection().collapse(false);}}else{this._getSelection().setBaseAndExtent(this._getDoc().body,1,this._getDoc().body,1);if(this.browser.webkit3){this._getSelection().collapseToStart();}else{this._getSelection().collapse(false);}}this._getWindow().focus();}else{this._getWindow().focus();}},_hasSelection:function(){var G=this._getSelection();var E=this._getRange();var F=false;if(!G||!E){return F;}if(this.browser.ie||this.browser.opera){if(E.text){F=true;}if(E.html){F=true;}}else{if(this.browser.webkit){if(G+""!==""){F=true;}}else{if(G&&(G.toString()!=="")&&(G!==undefined)){F=true;}}}return F;},_getSelection:function(){var E=null;if(this._getDoc()&&this._getWindow()){if(this._getDoc().selection){E=this._getDoc().selection;}else{E=this._getWindow().getSelection();}if(this.browser.webkit){if(E.baseNode){this._selection={};this._selection.baseNode=E.baseNode;this._selection.baseOffset=E.baseOffset;this._selection.extentNode=E.extentNode;this._selection.extentOffset=E.extentOffset;}else{if(this._selection!==null){E=this._getWindow().getSelection();E.setBaseAndExtent(this._selection.baseNode,this._selection.baseOffset,this._selection.extentNode,this._selection.extentOffset);this._selection=null;}}}}return E;},_selectNode:function(F,I){if(!F){return false;}var G=this._getSelection(),E=null;if(this.browser.ie){try{E=this._getDoc().body.createTextRange();E.moveToElementText(F);E.select();}catch(H){}}else{if(this.browser.webkit){if(I){G.setBaseAndExtent(F,1,F,F.innerText.length);}else{G.setBaseAndExtent(F,0,F,F.innerText.length);}}else{if(this.browser.opera){G=this._getWindow().getSelection();E=this._getDoc().createRange();E.selectNode(F);G.removeAllRanges();G.addRange(E);}else{E=this._getDoc().createRange();E.selectNodeContents(F);G.removeAllRanges();G.addRange(E);}}}this.nodeChange();},_getRange:function(){var E=this._getSelection();if(E===null){return null;}if(this.browser.webkit&&!E.getRangeAt){var H=this._getDoc().createRange();try{H.setStart(E.anchorNode,E.anchorOffset);H.setEnd(E.focusNode,E.focusOffset);}catch(G){H=this._getWindow().getSelection()+"";}return H;}if(this.browser.ie||this.browser.opera){try{return E.createRange();}catch(F){return null;}}if(E.rangeCount>0){return E.getRangeAt(0);}return null;},_setDesignMode:function(E){try{var G=true;if(this.browser.ie&&(E.toLowerCase()=="off")){G=false;}if(G){this._getDoc().designMode=E;}}catch(F){}},_toggleDesignMode:function(){var F=this._getDoc().designMode.toLowerCase(),E="on";if(F=="on"){E="off";}this._setDesignMode(E);return E;},_initEditorEvents:function(){var E=this._getDoc();A.on(E,"mouseup",this._handleMouseUp,this,true);A.on(E,"mousedown",this._handleMouseDown,this,true);A.on(E,"click",this._handleClick,this,true);A.on(E,"dblclick",this._handleDoubleClick,this,true);A.on(E,"keypress",this._handleKeyPress,this,true);A.on(E,"keyup",this._handleKeyUp,this,true);A.on(E,"keydown",this._handleKeyDown,this,true);},_removeEditorEvents:function(){var E=this._getDoc();A.removeListener(E,"mouseup",this._handleMouseUp,this,true);A.removeListener(E,"mousedown",this._handleMouseDown,this,true);A.removeListener(E,"click",this._handleClick,this,true);A.removeListener(E,"dblclick",this._handleDoubleClick,this,true);A.removeListener(E,"keypress",this._handleKeyPress,this,true);A.removeListener(E,"keyup",this._handleKeyUp,this,true);A.removeListener(E,"keydown",this._handleKeyDown,this,true);},_initEditor:function(){if(this.browser.ie){this._getDoc().body.style.margin="0";}if(!this.get("disabled")){if(this._getDoc().designMode.toLowerCase()!="on"){this._setDesignMode("on"); this._contentTimerCounter=0;}}if(!this._getDoc().body){this._contentTimerCounter=0;this._checkLoaded();return false;}this.toolbar.on("buttonClick",this._handleToolbarClick,this,true);if(!this.get("disabled")){this._initEditorEvents();this.toolbar.set("disabled",false);}this.fireEvent("editorContentLoaded",{type:"editorLoaded",target:this});if(this.get("dompath")){var E=this;setTimeout(function(){E._writeDomPath.call(E);E._setupResize.call(E);},150);}var G=[];for(var F in this.browser){if(this.browser[F]){G.push(F);}}if(this.get("ptags")){G.push("ptags");}C.addClass(this._getDoc().body,G.join(" "));this.nodeChange(true);},_checkLoaded:function(){this._contentTimerCounter++;if(this._contentTimer){clearTimeout(this._contentTimer);}if(this._contentTimerCounter>500){return false;}var G=false;try{if(this._getDoc()&&this._getDoc().body){if(this.browser.ie){if(this._getDoc().body.readyState=="complete"){G=true;}}else{if(this._getDoc().body._rteLoaded===true){G=true;}}}}catch(F){G=false;}if(G===true){this._initEditor();}else{var E=this;this._contentTimer=setTimeout(function(){E._checkLoaded.call(E);},20);}},_setInitialContent:function(){var H=((this._textarea)?this.get("element").value:this.get("element").innerHTML),J=null;var F=D.substitute(this.get("html"),{TITLE:this.STR_TITLE,CONTENT:this._cleanIncomingHTML(H),CSS:this.get("css"),HIDDEN_CSS:((this.get("hiddencss"))?this.get("hiddencss"):"/* No Hidden CSS */"),EXTRA_CSS:((this.get("extracss"))?this.get("extracss"):"/* No Extra CSS */")}),E=true;if(document.compatMode!="BackCompat"){F=this._docType+"\n"+F;}else{}if(this.browser.ie||this.browser.webkit||this.browser.opera||(navigator.userAgent.indexOf("Firefox/1.5")!=-1)){try{if(this.browser.air){J=this._getDoc().implementation.createHTMLDocument();var K=this._getDoc();K.open();K.close();J.open();J.write(F);J.close();var G=K.importNode(J.getElementsByTagName("html")[0],true);K.replaceChild(G,K.getElementsByTagName("html")[0]);K.body._rteLoaded=true;}else{J=this._getDoc();J.open();J.write(F);J.close();}}catch(I){E=false;}}else{this.get("iframe").get("element").src="data:text/html;charset=utf-8,"+encodeURIComponent(F);}this.get("iframe").setStyle("visibility","");if(E){this._checkLoaded();}},_setMarkupType:function(E){switch(this.get("markup")){case"css":this._setEditorStyle(true);break;case"default":this._setEditorStyle(false);break;case"semantic":case"xhtml":if(this._semantic[E]){this._setEditorStyle(false);}else{this._setEditorStyle(true);}break;}},_setEditorStyle:function(F){try{this._getDoc().execCommand("useCSS",false,!F);}catch(E){}},_getSelectedElement:function(){var I=this._getDoc(),F=null,G=null,J=null,E=true;if(this.browser.ie){this.currentEvent=this._getWindow().event;F=this._getRange();if(F){J=F.item?F.item(0):F.parentElement();if(this._hasSelection()){}if(J===I.body){J=null;}}if((this.currentEvent!==null)&&(this.currentEvent.keyCode===0)){J=A.getTarget(this.currentEvent);}}else{G=this._getSelection();F=this._getRange();if(!G||!F){return null;}if(!this._hasSelection()&&this.browser.webkit3){}if(this.browser.gecko){if(F.startContainer){E=false;if(F.startContainer.nodeType===3){J=F.startContainer.parentNode;}else{if(F.startContainer.nodeType===1){J=F.startContainer;}else{E=true;}}if(!E){this.currentEvent=null;}}}if(E){if(G.anchorNode&&(G.anchorNode.nodeType==3)){if(G.anchorNode.parentNode){J=G.anchorNode.parentNode;}if(G.anchorNode.nextSibling!=G.focusNode.nextSibling){J=G.anchorNode.nextSibling;}}if(this._isElement(J,"br")){J=null;}if(!J){J=F.commonAncestorContainer;if(!F.collapsed){if(F.startContainer==F.endContainer){if(F.startOffset-F.endOffset<2){if(F.startContainer.hasChildNodes()){J=F.startContainer.childNodes[F.startOffset];}}}}}}}if(this.currentEvent!==null){try{switch(this.currentEvent.type){case"click":case"mousedown":case"mouseup":if(this.browser.webkit){J=A.getTarget(this.currentEvent);}break;default:break;}}catch(H){}}else{if((this.currentElement&&this.currentElement[0])&&(!this.browser.ie)){}}if(this.browser.opera||this.browser.webkit){if(this.currentEvent&&!J){J=YAHOO.util.Event.getTarget(this.currentEvent);}}if(!J||!J.tagName){J=I.body;}if(this._isElement(J,"html")){J=I.body;}if(this._isElement(J,"body")){J=I.body;}if(J&&!J.parentNode){J=I.body;}if(J===undefined){J=null;}return J;},_getDomPath:function(E){if(!E){E=this._getSelectedElement();}var F=[];while(E!==null){if(E.ownerDocument!=this._getDoc()){E=null;break;}if(E.nodeName&&E.nodeType&&(E.nodeType==1)){F[F.length]=E;}if(this._isElement(E,"body")){break;}E=E.parentNode;}if(F.length===0){if(this._getDoc()&&this._getDoc().body){F[0]=this._getDoc().body;}}return F.reverse();},_writeDomPath:function(){var K=this._getDomPath(),I=[],G="",L="";for(var E=0;E10){L=''+L.substring(0,10)+"..."+"";}else{L=''+L+"";}I[I.length]=L;}}var H=I.join(" "+this.SEP_DOMPATH+" ");if(this.dompath.innerHTML!=H){this.dompath.innerHTML=H;}},_fixNodes:function(){var J=this._getDoc(),H=[];for(var E in this.invalidHTML){if(YAHOO.lang.hasOwnProperty(this.invalidHTML,E)){if(E.toLowerCase()!="span"){var F=J.body.getElementsByTagName(E); if(F.length){for(var G=0;G-1;E--){if(C.hasClass(J[E],this.CLASS_NOEDIT)){try{this._getDoc().execCommand("enableObjectResizing",false,"false");}catch(I){}this.nodeChange();A.stopEvent(G);return true;}}try{this._getDoc().execCommand("enableObjectResizing",false,"true");}catch(H){}}return false;},_setCurrentEvent:function(E){this.currentEvent=E;},_handleClick:function(G){var F=this.fireEvent("beforeEditorClick",{type:"beforeEditorClick",target:this,ev:G});if(F===false){return false;}if(this._isNonEditable(G)){return false;}this._setCurrentEvent(G);if(this.currentWindow){this.closeWindow();}if(this.currentWindow){this.closeWindow();}if(this.browser.webkit){var E=A.getTarget(G);if(this._isElement(E,"a")||this._isElement(E.parentNode,"a")){A.stopEvent(G);this.nodeChange();}}else{this.nodeChange();}this.fireEvent("editorClick",{type:"editorClick",target:this,ev:G});},_handleMouseUp:function(G){var F=this.fireEvent("beforeEditorMouseUp",{type:"beforeEditorMouseUp",target:this,ev:G});if(F===false){return false;}if(this._isNonEditable(G)){return false;}var E=this;if(this.browser.opera){var H=A.getTarget(G);if(this._isElement(H,"img")){this.nodeChange();if(this.operaEvent){clearTimeout(this.operaEvent);this.operaEvent=null;this._handleDoubleClick(G);}else{this.operaEvent=window.setTimeout(function(){E.operaEvent=false;},700);}}}if(this.browser.webkit||this.browser.opera){if(this.browser.webkit){A.stopEvent(G);}}this.nodeChange();this.fireEvent("editorMouseUp",{type:"editorMouseUp",target:this,ev:G});},_handleMouseDown:function(F){var E=this.fireEvent("beforeEditorMouseDown",{type:"beforeEditorMouseDown",target:this,ev:F});if(E===false){return false;}if(this._isNonEditable(F)){return false;}this._setCurrentEvent(F);var G=A.getTarget(F);if(this.browser.webkit&&this._hasSelection()){var H=this._getSelection();if(!this.browser.webkit3){H.collapse(true);}else{H.collapseToStart();}}if(this.browser.webkit&&this._lastImage){C.removeClass(this._lastImage,"selected");this._lastImage=null;}if(this._isElement(G,"img")||this._isElement(G,"a")){if(this.browser.webkit){A.stopEvent(F);if(this._isElement(G,"img")){C.addClass(G,"selected");this._lastImage=G;}}if(this.currentWindow){this.closeWindow();}this.nodeChange();}this.fireEvent("editorMouseDown",{type:"editorMouseDown",target:this,ev:F});},_handleDoubleClick:function(F){var E=this.fireEvent("beforeEditorDoubleClick",{type:"beforeEditorDoubleClick",target:this,ev:F});if(E===false){return false;}if(this._isNonEditable(F)){return false;}this._setCurrentEvent(F);var G=A.getTarget(F);if(this._isElement(G,"img")){this.currentElement[0]=G;this.toolbar.fireEvent("insertimageClick",{type:"insertimageClick",target:this.toolbar});this.fireEvent("afterExecCommand",{type:"afterExecCommand",target:this});}else{if(this._hasParent(G,"a")){this.currentElement[0]=this._hasParent(G,"a");this.toolbar.fireEvent("createlinkClick",{type:"createlinkClick",target:this.toolbar});this.fireEvent("afterExecCommand",{type:"afterExecCommand",target:this});}}this.nodeChange();this.fireEvent("editorDoubleClick",{type:"editorDoubleClick",target:this,ev:F});},_handleKeyUp:function(G){var F=this.fireEvent("beforeEditorKeyUp",{type:"beforeEditorKeyUp",target:this,ev:G});if(F===false){return false;}if(this._isNonEditable(G)){return false;}this._setCurrentEvent(G);switch(G.keyCode){case this._keyMap.SELECT_ALL.key:if(this._checkKey(this._keyMap.SELECT_ALL,G)){this.nodeChange();}break;case 32:case 35:case 36:case 37:case 38:case 39:case 40:case 46:case 8:case this._keyMap.CLOSE_WINDOW.key:if((G.keyCode==this._keyMap.CLOSE_WINDOW.key)&&this.currentWindow){if(this._checkKey(this._keyMap.CLOSE_WINDOW,G)){this.closeWindow();}}else{if(!this.browser.ie){if(this._nodeChangeTimer){clearTimeout(this._nodeChangeTimer);}var E=this;this._nodeChangeTimer=setTimeout(function(){E._nodeChangeTimer=null;E.nodeChange.call(E);},100);}else{this.nodeChange();}this.editorDirty=true;}break;}this.fireEvent("editorKeyUp",{type:"editorKeyUp",target:this,ev:G});this._storeUndo();},_handleKeyPress:function(G){var F=this.fireEvent("beforeEditorKeyPress",{type:"beforeEditorKeyPress",target:this,ev:G});if(F===false){return false;}if(this.get("allowNoEdit")){if(G&&G.keyCode&&(G.keyCode==63272)){A.stopEvent(G);}}if(this._isNonEditable(G)){return false;}this._setCurrentEvent(G);if(this.browser.opera){if(G.keyCode===13){var E=this._getSelectedElement();if(!this._isElement(E,"li")){this.execCommand("inserthtml","
");A.stopEvent(G);}}}if(this.browser.webkit){if(!this.browser.webkit3){if(G.keyCode&&(G.keyCode==122)&&(G.metaKey)){if(this._hasParent(this._getSelectedElement(),"li")){A.stopEvent(G);}}}this._listFix(G);}this.fireEvent("editorKeyPress",{type:"editorKeyPress",target:this,ev:G});},_handleKeyDown:function(M){var J=this.fireEvent("beforeEditorKeyDown",{type:"beforeEditorKeyDown",target:this,ev:M});if(J===false){return false;}var I=null,K=null;if(this._isNonEditable(M)){return false;}this._setCurrentEvent(M);if(this.currentWindow){this.closeWindow();}if(this.currentWindow){this.closeWindow();}var L=false,G=null,F=false;switch(M.keyCode){case this._keyMap.FOCUS_TOOLBAR.key:if(this._checkKey(this._keyMap.FOCUS_TOOLBAR,M)){var H=this.toolbar.getElementsByTagName("h2")[0];if(H&&H.firstChild){H.firstChild.focus();}}else{if(this._checkKey(this._keyMap.FOCUS_AFTER,M)){this.afterElement.focus();}}A.stopEvent(M);L=false;break;case this._keyMap.CREATE_LINK.key:if(this._hasSelection()){if(this._checkKey(this._keyMap.CREATE_LINK,M)){var E=true; if(this.get("limitCommands")){if(!this.toolbar.getButtonByValue("createlink")){E=false;}}if(E){this.execCommand("createlink","");this.toolbar.fireEvent("createlinkClick",{type:"createlinkClick",target:this.toolbar});this.fireEvent("afterExecCommand",{type:"afterExecCommand",target:this});L=false;}}}break;case this._keyMap.UNDO.key:case this._keyMap.REDO.key:if(this._checkKey(this._keyMap.REDO,M)){G="redo";L=true;}else{if(this._checkKey(this._keyMap.UNDO,M)){G="undo";L=true;}}break;case this._keyMap.BOLD.key:if(this._checkKey(this._keyMap.BOLD,M)){G="bold";L=true;}break;case this._keyMap.ITALIC.key:if(this._checkKey(this._keyMap.ITALIC,M)){G="italic";L=true;}break;case this._keyMap.UNDERLINE.key:if(this._checkKey(this._keyMap.UNDERLINE,M)){G="underline";L=true;}break;case 9:if(this.browser.ie){K=this._getRange();I=this._getSelectedElement();if(!this._isElement(I,"li")){if(K){K.pasteHTML("    ");K.collapse(false);K.select();}A.stopEvent(M);}}if(this.browser.gecko>1.8){I=this._getSelectedElement();if(this._isElement(I,"li")){if(M.shiftKey){this._getDoc().execCommand("outdent",null,"");}else{this._getDoc().execCommand("indent",null,"");}}else{if(!this._hasSelection()){this.execCommand("inserthtml","    ");}}A.stopEvent(M);}break;case 13:if(this.get("ptags")&&!M.shiftKey){if(this.browser.gecko){I=this._getSelectedElement();if(!this._isElement(I,"li")){L=true;G="insertparagraph";A.stopEvent(M);}}if(this.browser.webkit){I=this._getSelectedElement();if(!this._hasParent(I,"li")){L=true;G="insertparagraph";A.stopEvent(M);}}}else{if(this.browser.ie){K=this._getRange();I=this._getSelectedElement();if(!this._isElement(I,"li")){if(K){K.pasteHTML("
");K.collapse(false);K.select();}A.stopEvent(M);}}}break;}if(this.browser.ie){this._listFix(M);}if(L&&G){this.execCommand(G,null);A.stopEvent(M);this.nodeChange();}this.fireEvent("editorKeyDown",{type:"editorKeyDown",target:this,ev:M});},_listFix:function(K){var M=null,I=null,E=false,G=null;if(this.browser.webkit){if(K.keyCode&&(K.keyCode==13)){if(this._hasParent(this._getSelectedElement(),"li")){var H=this._hasParent(this._getSelectedElement(),"li");if(H.previousSibling){if(H.firstChild&&(H.firstChild.length==1)){this._selectNode(H);}}}}}if(K.keyCode&&((!this.browser.webkit3&&(K.keyCode==25))||((this.browser.webkit3||!this.browser.webkit)&&((K.keyCode==9)&&K.shiftKey)))){M=this._getSelectedElement();if(this._hasParent(M,"li")){M=this._hasParent(M,"li");if(this._hasParent(M,"ul")||this._hasParent(M,"ol")){I=this._hasParent(M,"ul");if(!I){I=this._hasParent(M,"ol");}if(this._isElement(I.previousSibling,"li")){I.removeChild(M);I.parentNode.insertBefore(M,I.nextSibling);if(this.browser.ie){G=this._getDoc().body.createTextRange();G.moveToElementText(M);G.collapse(false);G.select();}if(this.browser.webkit){this._selectNode(M.firstChild);}A.stopEvent(K);}}}}if(K.keyCode&&((K.keyCode==9)&&(!K.shiftKey))){var F=this._getSelectedElement();if(this._hasParent(F,"li")){E=this._hasParent(F,"li").innerHTML;}if(this.browser.webkit){this._getDoc().execCommand("inserttext",false,"\t");}M=this._getSelectedElement();if(this._hasParent(M,"li")){I=this._hasParent(M,"li");var J=this._getDoc().createElement(I.parentNode.tagName.toLowerCase());if(this.browser.webkit){var L=C.getElementsByClassName("Apple-tab-span","span",I);if(L[0]){I.removeChild(L[0]);I.innerHTML=D.trim(I.innerHTML);if(E){I.innerHTML=''+E+" ";}else{I.innerHTML='  ';}}}else{if(E){I.innerHTML=E+" ";}else{I.innerHTML=" ";}}I.parentNode.replaceChild(J,I);J.appendChild(I);if(this.browser.webkit){this._getSelection().setBaseAndExtent(I.firstChild,1,I.firstChild,I.firstChild.innerText.length);if(!this.browser.webkit3){I.parentNode.parentNode.style.display="list-item";setTimeout(function(){I.parentNode.parentNode.style.display="block";},1);}}else{if(this.browser.ie){G=this._getDoc().body.createTextRange();G.moveToElementText(I);G.collapse(false);G.select();}else{this._selectNode(I);}}A.stopEvent(K);}if(this.browser.webkit){A.stopEvent(K);}this.nodeChange();}},nodeChange:function(E){var F=this;this._storeUndo();if(this.get("nodeChangeDelay")){window.setTimeout(function(){F._nodeChange.apply(F,arguments);},0);}else{this._nodeChange();}},_nodeChange:function(F){var H=parseInt(this.get("nodeChangeThreshold"),10),O=Math.round(new Date().getTime()/1000),R=this;if(F===true){this._lastNodeChange=0;}if((this._lastNodeChange+H)0){for(var V=0;V'+Y+"");this._updateMenuChecked("fontname",Y);}if(L){L.set("label",L._configs.label._initialConfig.value);}var K=this.toolbar.getButtonByValue("heading");if(K){K.set("label",K._configs.label._initialConfig.value);this._updateMenuChecked("heading","none");}var I=this.toolbar.getButtonByValue("insertimage");if(I&&this.currentWindow&&(this.currentWindow.name=="insertimage")){this.toolbar.disableButton(I);}if(this._lastButton&&this._lastButton.isSelected){this.toolbar.deselectButton(this._lastButton.id);}this._undoNodeChange();}}this.fireEvent("afterNodeChange",{type:"afterNodeChange",target:this});},_updateMenuChecked:function(E,F,H){if(!H){H=this.toolbar;}var G=H.getButtonByValue(E);G.checkValue(F);},_handleToolbarClick:function(F){var H="";var I="";var G=F.button.value;if(F.button.menucmd){H=G;G=F.button.menucmd;}this._lastButton=F.button;if(this.STOP_EXEC_COMMAND){this.STOP_EXEC_COMMAND=false;return false;}else{this.execCommand(G,H);if(!this.browser.webkit){var E=this;setTimeout(function(){E._focusWindow.call(E);},5);}}A.stopEvent(F);},_setupAfterElement:function(){if(!this.beforeElement){this.beforeElement=document.createElement("h2");this.beforeElement.className="yui-editor-skipheader";this.beforeElement.tabIndex="-1";this.beforeElement.innerHTML=this.STR_BEFORE_EDITOR;this.get("element_cont").get("firstChild").insertBefore(this.beforeElement,this.toolbar.get("nextSibling"));}if(!this.afterElement){this.afterElement=document.createElement("h2");this.afterElement.className="yui-editor-skipheader";this.afterElement.tabIndex="-1";this.afterElement.innerHTML=this.STR_LEAVE_EDITOR;this.get("element_cont").get("firstChild").appendChild(this.afterElement);}},_disableEditor:function(F){if(F){this._removeEditorEvents();if(!this._mask){if(!!this.browser.ie){this._setDesignMode("off");}if(this.toolbar){this.toolbar.set("disabled",true);}this._mask=document.createElement("DIV");C.setStyle(this._mask,"height","100%");C.setStyle(this._mask,"width","100%");C.setStyle(this._mask,"position","absolute");C.setStyle(this._mask,"top","0");C.setStyle(this._mask,"left","0");C.setStyle(this._mask,"opacity",".5");C.addClass(this._mask,"yui-editor-masked");this.get("iframe").get("parentNode").appendChild(this._mask);}}else{this._initEditorEvents();if(this._mask){this._mask.parentNode.removeChild(this._mask);this._mask=null;if(this.toolbar){this.toolbar.set("disabled",false);}this._setDesignMode("on");this._focusWindow();var E=this;window.setTimeout(function(){E.nodeChange.call(E);},100);}}},SEP_DOMPATH:"<",STR_LEAVE_EDITOR:"You have left the Rich Text Editor.",STR_BEFORE_EDITOR:"This text field can contain stylized text and graphics. To cycle through all formatting options, use the keyboard shortcut Shift + Escape to place focus on the toolbar and navigate between options with your arrow keys. To exit this text editor use the Escape key and continue tabbing.

Common formatting keyboard shortcuts:

  • Control Shift B sets text to bold
  • Control Shift I sets text to italic
  • Control Shift U underlines text
  • Control Shift L adds an HTML link
",STR_TITLE:"Rich Text Area.",STR_IMAGE_HERE:"Image URL Here",STR_LINK_URL:"Link URL",STOP_EXEC_COMMAND:false,STOP_NODE_CHANGE:false,CLASS_NOEDIT:"yui-noedit",CLASS_CONTAINER:"yui-editor-container",CLASS_EDITABLE:"yui-editor-editable",CLASS_EDITABLE_CONT:"yui-editor-editable-container",CLASS_PREFIX:"yui-editor",browser:function(){var E=YAHOO.env.ua;if(E.webkit>=420){E.webkit3=E.webkit;}else{E.webkit3=0;}E.mac=false;if(navigator.userAgent.indexOf("Macintosh")!==-1){E.mac=true;}return E;}(),init:function(F,E){if(!this._defaultToolbar){this._defaultToolbar={collapse:true,titlebar:"Text Editing Tools",draggable:false,buttons:[{group:"fontstyle",label:"Font Name and Size",buttons:[{type:"select",label:"Arial",value:"fontname",disabled:true,menu:[{text:"Arial",checked:true},{text:"Arial Black"},{text:"Comic Sans MS"},{text:"Courier New"},{text:"Lucida Console"},{text:"Tahoma"},{text:"Times New Roman"},{text:"Trebuchet MS"},{text:"Verdana"}]},{type:"spin",label:"13",value:"fontsize",range:[9,75],disabled:true}]},{type:"separator"},{group:"textstyle",label:"Font Style",buttons:[{type:"push",label:"Bold CTRL + SHIFT + B",value:"bold"},{type:"push",label:"Italic CTRL + SHIFT + I",value:"italic"},{type:"push",label:"Underline CTRL + SHIFT + U",value:"underline"},{type:"push",label:"Strike Through",value:"strikethrough"},{type:"separator"},{type:"color",label:"Font Color",value:"forecolor",disabled:true},{type:"color",label:"Background Color",value:"backcolor",disabled:true}]},{type:"separator"},{group:"indentlist",label:"Lists",buttons:[{type:"push",label:"Create an Unordered List",value:"insertunorderedlist"},{type:"push",label:"Create an Ordered List",value:"insertorderedlist"}]},{type:"separator"},{group:"insertitem",label:"Insert Item",buttons:[{type:"push",label:"HTML Link CTRL + SHIFT + L",value:"createlink",disabled:true},{type:"push",label:"Insert Image",value:"insertimage"}]}]}; }YAHOO.widget.SimpleEditor.superclass.init.call(this,F,E);YAHOO.widget.EditorInfo._instances[this.get("id")]=this;this.currentElement=[];this.on("contentReady",function(){this.DOMReady=true;this.fireQueue();},this,true);},initAttributes:function(E){YAHOO.widget.SimpleEditor.superclass.initAttributes.call(this,E);var F=this;this.setAttributeConfig("nodeChangeDelay",{value:((E.nodeChangeDelay===false)?false:true)});this.setAttributeConfig("maxUndo",{writeOnce:true,value:E.maxUndo||30});this.setAttributeConfig("ptags",{writeOnce:true,value:E.ptags||false});this.setAttributeConfig("insert",{writeOnce:true,value:E.insert||false,method:function(K){if(K){var J={fontname:true,fontsize:true,forecolor:true,backcolor:true};var I=this._defaultToolbar.buttons;for(var H=0;H{TITLE}{CONTENT}',writeOnce:true});this.setAttributeConfig("extracss",{value:E.extracss||"",writeOnce:true});this.setAttributeConfig("handleSubmit",{value:E.handleSubmit||false,method:function(G){if(this.get("element").form){if(!this._formButtons){this._formButtons=[];}if(G){A.on(this.get("element").form,"submit",this._handleFormSubmit,this,true);var H=this.get("element").form.getElementsByTagName("input");for(var J=0;J=parseInt(this.get("height"),10))){C.setStyle(this.get("editor_wrapper"),"height",G+"px");if(this.browser.ie){this.get("iframe").setStyle("height","99%");this.get("iframe").setStyle("zoom","1");var H=this;window.setTimeout(function(){H.get("iframe").setStyle("height","100%");},1);}}},_formButtons:null,_formButtonClicked:null,_handleFormButtonClick:function(F){var E=A.getTarget(F);this._formButtonClicked=E;},_handleFormSubmit:function(H){this.saveHTML();var G=this.get("element").form,E=this._formButtonClicked||false;A.removeListener(G,"submit",this._handleFormSubmit);if(YAHOO.env.ua.ie){if(E&&!E.disabled){E.click();}}else{if(E&&!E.disabled){E.click();}var F=document.createEvent("HTMLEvents");F.initEvent("submit",true,true);G.dispatchEvent(F);if(YAHOO.env.ua.webkit){if(YAHOO.lang.isFunction(G.submit)){G.submit();}}}},_handleFontSize:function(G){var E=this.toolbar.getButtonById(G.button.id);var F=E.get("label")+"px";this.execCommand("fontsize",F);this.STOP_EXEC_COMMAND=true;},_handleColorPicker:function(G){var F=G.button;var E="#"+G.color;if((F=="forecolor")||(F=="backcolor")){this.execCommand(F,E);}},_handleAlign:function(H){var G=null;for(var E=0;E'+H+"";if(J.get("label")!=N){J.set("label",N);this._updateMenuChecked("fontname",H);}}if(K){M=parseInt(C.getStyle(L,"fontSize"),10);if((M===null)||isNaN(M)){M=K._configs.label._initialConfig.value;}K.set("label",""+M);}if(!this._isElement(L,"body")&&!this._isElement(L,"img")){this.toolbar.enableButton(J);this.toolbar.enableButton(K);this.toolbar.enableButton("forecolor");this.toolbar.enableButton("backcolor");}if(this._isElement(L,"img")){if(YAHOO.widget.Overlay){this.toolbar.enableButton("createlink");}}if(this._hasParent(L,"blockquote")){this.toolbar.selectButton("indent");this.toolbar.disableButton("indent");this.toolbar.enableButton("outdent");}if(this._hasParent(L,"ol")||this._hasParent(L,"ul")){this.toolbar.disableButton("indent");}this._lastButton=null;},_handleInsertImageClick:function(){if(this.get("limitCommands")){if(!this.toolbar.getButtonByValue("insertimage")){return false;}}this.toolbar.set("disabled",true);this.on("afterExecCommand",function(){var E=this.currentElement[0],G="http://";if(!E){E=this._getSelectedElement();}if(E){if(E.getAttribute("src")){G=E.getAttribute("src",2);if(G.indexOf(this.get("blankimage"))!=-1){G=this.STR_IMAGE_HERE;}}}var F=prompt(this.STR_LINK_URL+": ",G);if((F!=="")&&(F!==null)){E.setAttribute("src",F);}else{if(F===null){E.parentNode.removeChild(E);this.currentElement=[];this.nodeChange();}}this.closeWindow();this.toolbar.set("disabled",false);},this,true);},_handleInsertImageWindowClose:function(){this.nodeChange();},_isLocalFile:function(E){if((E)&&(E!=="")&&((E.indexOf("file:/")!=-1)||(E.indexOf(":\\")!=-1))){return true;}return false;},_handleCreateLinkClick:function(){if(this.get("limitCommands")){if(!this.toolbar.getButtonByValue("createlink")){return false;}}this.toolbar.set("disabled",true);this.on("afterExecCommand",function(){var G=this.currentElement[0],F="";if(G){if(G.getAttribute("href",2)!==null){F=G.getAttribute("href",2);}}var I=prompt(this.STR_LINK_URL+": ",F);if((I!=="")&&(I!==null)){var H=I;if((H.indexOf(":/"+"/")==-1)&&(H.substring(0,1)!="/")&&(H.substring(0,6).toLowerCase()!="mailto")){if((H.indexOf("@")!=-1)&&(H.substring(0,6).toLowerCase()!="mailto")){H="mailto:"+H;}else{if(H.substring(0,1)!="#"){}}}G.setAttribute("href",H);}else{if(I!==null){var E=this._getDoc().createElement("span");E.innerHTML=G.innerHTML;C.addClass(E,"yui-non");G.parentNode.replaceChild(E,G);}}this.closeWindow();this.toolbar.set("disabled",false);},this);},_handleCreateLinkWindowClose:function(){this.nodeChange();this.currentElement=[]; },render:function(){if(this._rendered){return false;}if(!this.DOMReady){this._queue[this._queue.length]=["render",arguments];return false;}if(this.get("element")){if(this.get("element").tagName){this._textarea=true;if(this.get("element").tagName.toLowerCase()!=="textarea"){this._textarea=false;}}else{return false;}}else{return false;}this._rendered=true;var E=this;window.setTimeout(function(){E._render.call(E);},4);},_render:function(){var E=this;this.set("textarea",this.get("element"));this.get("element_cont").setStyle("display","none");this.get("element_cont").addClass(this.CLASS_CONTAINER);this.set("iframe",this._createIframe());window.setTimeout(function(){E._setInitialContent.call(E);},10);this.get("editor_wrapper").appendChild(this.get("iframe").get("element"));if(this.get("disabled")){this._disableEditor(true);}var F=this.get("toolbar");if(F instanceof B){this.toolbar=F;this.toolbar.set("disabled",true);}else{F.disabled=true;this.toolbar=new B(this.get("toolbar_cont"),F);}this.fireEvent("toolbarLoaded",{type:"toolbarLoaded",target:this.toolbar});this.toolbar.on("toolbarCollapsed",function(){if(this.currentWindow){this.moveWindow();}},this,true);this.toolbar.on("toolbarExpanded",function(){if(this.currentWindow){this.moveWindow();}},this,true);this.toolbar.on("fontsizeClick",this._handleFontSize,this,true);this.toolbar.on("colorPickerClicked",function(G){this._handleColorPicker(G);return false;},this,true);this.toolbar.on("alignClick",this._handleAlign,this,true);this.on("afterNodeChange",this._handleAfterNodeChange,this,true);this.toolbar.on("insertimageClick",this._handleInsertImageClick,this,true);this.on("windowinsertimageClose",this._handleInsertImageWindowClose,this,true);this.toolbar.on("createlinkClick",this._handleCreateLinkClick,this,true);this.on("windowcreatelinkClose",this._handleCreateLinkWindowClose,this,true);this.get("parentNode").replaceChild(this.get("element_cont").get("element"),this.get("element"));this.setStyle("visibility","hidden");this.setStyle("position","absolute");this.setStyle("top","-9999px");this.setStyle("left","-9999px");this.get("element_cont").appendChild(this.get("element"));this.get("element_cont").setStyle("display","block");C.addClass(this.get("iframe").get("parentNode"),this.CLASS_EDITABLE_CONT);this.get("iframe").addClass(this.CLASS_EDITABLE);this.get("element_cont").setStyle("width",this.get("width"));C.setStyle(this.get("iframe").get("parentNode"),"height",this.get("height"));this.get("iframe").setStyle("width","100%");this.get("iframe").setStyle("height","100%");this._setupDD();window.setTimeout(function(){E._setupAfterElement.call(E);},0);this.fireEvent("afterRender",{type:"afterRender",target:this});},execCommand:function(G,F){var J=this.fireEvent("beforeExecCommand",{type:"beforeExecCommand",target:this,args:arguments});if((J===false)||(this.STOP_EXEC_COMMAND)){this.STOP_EXEC_COMMAND=false;return false;}this._lastCommand=G;this._setMarkupType(G);if(this.browser.ie){this._getWindow().focus();}var E=true;if(this.get("limitCommands")){if(!this.toolbar.getButtonByValue(G)){E=false;}}this.editorDirty=true;if((typeof this["cmd_"+G.toLowerCase()]=="function")&&E){var I=this["cmd_"+G.toLowerCase()](F);E=I[0];if(I[1]){G=I[1];}if(I[2]){F=I[2];}}if(E){try{this._getDoc().execCommand(G,false,F);}catch(H){}}else{}this.on("afterExecCommand",function(){this.unsubscribeAll("afterExecCommand");this.nodeChange();},this,true);this.fireEvent("afterExecCommand",{type:"afterExecCommand",target:this});},cmd_underline:function(F){if(!this.browser.webkit){var E=this._getSelectedElement();if(E&&this._isElement(E,"span")){if(E.style.textDecoration=="underline"){E.style.textDecoration="none";}else{E.style.textDecoration="underline";}return[false];}}return[true];},cmd_backcolor:function(H){var E=true,F=this._getSelectedElement(),G="backcolor";if(this.browser.gecko||this.browser.opera){this._setEditorStyle(true);G="hilitecolor";}if(!this._isElement(F,"body")&&!this._hasSelection()){C.setStyle(F,"background-color",H);this._selectNode(F);E=false;}else{if(!this._isElement(F,"body")&&this._hasSelection()){C.setStyle(F,"background-color",H);this._selectNode(F);E=false;}else{if(this.get("insert")){F=this._createInsertElement({backgroundColor:H});}else{this._createCurrentElement("span",{backgroundColor:H});this._selectNode(this.currentElement[0]);}E=false;}}return[E,G];},cmd_forecolor:function(G){var E=true,F=this._getSelectedElement();if(!this._isElement(F,"body")&&!this._hasSelection()){C.setStyle(F,"color",G);this._selectNode(F);E=false;}else{if(!this._isElement(F,"body")&&this._hasSelection()){C.setStyle(F,"color",G);this._selectNode(F);E=false;}else{if(this.get("insert")){F=this._createInsertElement({color:G});}else{this._createCurrentElement("span",{color:G});this._selectNode(this.currentElement[0]);}E=false;}}return[E];},cmd_unlink:function(E){this._swapEl(this.currentElement[0],"span",function(F){F.className="yui-non";});return[false];},cmd_createlink:function(G){var F=this._getSelectedElement(),E=null;if(this._hasParent(F,"a")){this.currentElement[0]=this._hasParent(F,"a");}else{if(!this._isElement(F,"a")){this._createCurrentElement("a");E=this._swapEl(this.currentElement[0],"a");this.currentElement[0]=E;}else{this.currentElement[0]=F;}}return[false];},cmd_insertimage:function(J){var E=true,F=null,I="insertimage",H=this._getSelectedElement();if(J===""){J=this.get("blankimage");}if(this._isElement(H,"img")){this.currentElement[0]=H;E=false;}else{if(this._getDoc().queryCommandEnabled(I)){this._getDoc().execCommand("insertimage",false,J);var K=this._getDoc().getElementsByTagName("img");for(var G=0;G"+F[M].innerHTML+"";}V.innerHTML=R;this.currentElement[0]=G;this.currentElement[0].parentNode.replaceChild(V,this.currentElement[0]);}else{this._createCurrentElement(Y.toLowerCase());V=this._getDoc().createElement(Y);for(M=0;M  ';V.appendChild(J);if(M>0){this.currentElement[M].parentNode.removeChild(this.currentElement[M]);}}this.currentElement[0].parentNode.replaceChild(V,this.currentElement[0]);this.currentElement[0]=V;var H=this.currentElement[0].firstChild;H=C.getElementsByClassName("yui-non","span",H)[0];this._getSelection().setBaseAndExtent(H,1,H,H.innerText.length);}S=false;}else{G=this._getSelectedElement();if(this._isElement(G,"li")&&this._isElement(G.parentNode,Y)||(this.browser.ie&&this._isElement(this._getRange().parentElement,"li"))||(this.browser.ie&&this._isElement(G,"ul"))||(this.browser.ie&&this._isElement(G,"ol"))){if(this.browser.ie){if((this.browser.ie&&this._isElement(G,"ul"))||(this.browser.ie&&this._isElement(G,"ol"))){G=G.getElementsByTagName("li")[0];}R="";var I=G.parentNode.getElementsByTagName("li");for(var U=0;U";}var X=this._getDoc().createElement("span");X.innerHTML=R;G.parentNode.parentNode.replaceChild(X,G.parentNode);}else{this.nodeChange();this._getDoc().execCommand(T,"",G.parentNode);this.nodeChange();}S=false;}if(this.browser.opera){var Q=this;window.setTimeout(function(){var Z=Q._getDoc().getElementsByTagName("li");for(var a=0;a"){Z[a].parentNode.parentNode.removeChild(Z[a].parentNode);}}},30);}if(this.browser.ie&&S){var K="";if(this._getRange().html){K="
  • "+this._getRange().html+"
  • ";}else{var L=this._getRange().text.split("\n");if(L.length>1){K="";for(var P=0;P"+L[P]+"";}}else{var O=this._getRange().text;if(O===""){K='
  • '+O+"
  • ";}else{K="
  • "+O+"
  • ";}}}this._getRange().pasteHTML("<"+Y+">"+K+"");var E=this._getDoc().getElementById("new_list_item");if(E){var N=this._getDoc().body.createTextRange();N.moveToElementText(E);N.collapse(false);N.select();E.id="";}S=false;}}return S;},cmd_insertorderedlist:function(E){return[this.cmd_list("ol")];},cmd_insertunorderedlist:function(E){return[this.cmd_list("ul")];},cmd_fontname:function(H){var E=true,G=this._getSelectedElement();this.currentFont=H;if(G&&G.tagName&&!this._hasSelection()&&!this._isElement(G,"body")&&!this.get("insert")){YAHOO.util.Dom.setStyle(G,"font-family",H);E=false;}else{if(this.get("insert")&&!this._hasSelection()){var F=this._createInsertElement({fontFamily:H});E=false;}}return[E];},cmd_fontsize:function(G){var E=null;if(this.currentElement&&(this.currentElement.length>0)&&(!this._hasSelection())&&(!this.get("insert"))){YAHOO.util.Dom.setStyle(this.currentElement,"fontSize",G);}else{if(!this._isElement(this._getSelectedElement(),"body")){E=this._getSelectedElement();YAHOO.util.Dom.setStyle(E,"fontSize",G);if(this.get("insert")&&this.browser.ie){var F=this._getRange();F.collapse(false);F.select();}else{this._selectNode(E);}}else{if(this.get("insert")&&!this._hasSelection()){E=this._createInsertElement({fontSize:G});this.currentElement[0]=E;this._selectNode(this.currentElement[0]);}else{this._createCurrentElement("span",{"fontSize":G});this._selectNode(this.currentElement[0]);}}}return[false];},_swapEl:function(F,E,H){var G=this._getDoc().createElement(E);if(F){G.innerHTML=F.innerHTML;}if(typeof H=="function"){H.call(this,G);}if(F){F.parentNode.replaceChild(G,F);}return G;},_createInsertElement:function(E){this._createCurrentElement("span",E);var F=this.currentElement[0];if(this.browser.webkit){F.innerHTML=' ';F=F.firstChild;this._getSelection().setBaseAndExtent(F,1,F,F.innerText.length);}else{if(this.browser.ie||this.browser.opera){F.innerHTML=" ";}}this._focusWindow();this._selectNode(F,true);return F;},_createCurrentElement:function(G,J){G=((G)?G:"a");var R=null,F=[],H=this._getDoc();if(this.currentFont){if(!J){J={};}J.fontFamily=this.currentFont;this.currentFont=null;}this.currentElement=[];var M=function(X,Z){var Y=null;X=((X)?X:"span");X=X.toLowerCase();switch(X){case"h1":case"h2":case"h3":case"h4":case"h5":case"h6":Y=H.createElement(X);break;default:Y=H.createElement(X);if(X==="span"){YAHOO.util.Dom.addClass(Y,"yui-tag-"+X);YAHOO.util.Dom.addClass(Y,"yui-tag");Y.setAttribute("tag",X);}for(var W in Z){if(YAHOO.lang.hasOwnProperty(Z,W)){Y.style[W]=Z[W];}}break;}return Y;};if(!this._hasSelection()){if(this._getDoc().queryCommandEnabled("insertimage")){this._getDoc().execCommand("insertimage",false,"yui-tmp-img");var L=this._getDoc().getElementsByTagName("img");for(var Q=0;Q]*)>/gi,"");E=E.replace(/<\/strong>/gi,"");E=E.replace(/]*)>/gi,"");E=E.replace(/<\/embed>/gi,"");E=E.replace(/]*)>/gi,"");E=E.replace(/<\/em>/gi,"");E=E.replace(/]*)>/gi,"");E=E.replace(/<\/YUI_EMBED>/gi,"");if(this.get("plainText")){E=E.replace(/\n/g,"
    ").replace(/\r/g,"
    ");E=E.replace(/ /gi,"  ");E=E.replace(/\t/gi,"    ");}E=E.replace(/]*)>/gi,"");E=E.replace(/<\/script([^>]*)>/gi,"");E=E.replace(/<script([^>]*)>/gi,"");E=E.replace(/<\/script([^>]*)>/gi,"");E=E.replace(/\n/g,"").replace(/\r/g,"");E=E.replace(new RegExp("]*)>(.*?)","gi"),"");E=E.replace(//g,"\n");return E;},cleanHTML:function(G){if(!G){G=this.getEditorHTML();}var F=this.get("markup");G=this.pre_filter_linebreaks(G,F);G=G.replace(/]*)\/>/gi,"");G=G.replace(/]*)>/gi,"");G=G.replace(/]*)\/>/gi,"");G=G.replace(/]*)>/gi,"");G=G.replace(/]*)>/gi,"");G=G.replace(/<\/ul>/gi,"");G=G.replace(/]*)>/gi,"");G=G.replace(/<\/blockquote>/gi,"");G=G.replace(/]*)>/gi,"");G=G.replace(/<\/embed>/gi,"");if((F=="semantic")||(F=="xhtml")){G=G.replace(/]*)?>/gi,"");G=G.replace(/<\/i>/gi,"");G=G.replace(/]*)?>/gi,"");G=G.replace(/<\/b>/gi,"");}G=G.replace(//gi,"");G=G.replace(//gi,"");if((F=="semantic")||(F=="xhtml")||(F=="css")){G=G.replace(new RegExp(']*)face="([^>]*)">(.*?)',"gi"),'$3');G=G.replace(/([^>]*)',"gi"),"$1");G=G.replace(new RegExp('([^>]*)',"gi"),"$1");}G=G.replace(/\/u>/gi,"/span>");if(F=="css"){G=G.replace(/]*)>/gi,"");G=G.replace(/<\/em>/gi,"");G=G.replace(/]*)>/gi,"");G=G.replace(/<\/strong>/gi,"");G=G.replace(//gi,"/span>");G=G.replace(//gi,"/span>");}G=G.replace(/ /gi," ");}else{G=G.replace(//gi,"/u>");}G=G.replace(/]*)>/gi,"");G=G.replace(/\/ol>/gi,"/ol>");G=G.replace(/
  • /gi,"/li>");G=this.filter_safari(G);G=this.filter_internals(G);G=this.filter_all_rgb(G);G=this.post_filter_linebreaks(G,F);if(F=="xhtml"){G=G.replace(/]*)>/g,"");G=G.replace(/]*)>/g,"");}else{G=G.replace(/]*)>/g,"");G=G.replace(/]*)>/g,"");}G=G.replace(/]*)>/g,"");G=G.replace(/<\/YUI_UL>/g,"");G=this.filter_invalid_lists(G);G=G.replace(/]*)>/g,"");G=G.replace(/<\/YUI_BQ>/g,"");G=G.replace(/]*)>/g,"");G=G.replace(/<\/YUI_EMBED>/g,"");G=G.replace(" & ","YUI_AMP");G=G.replace("&","&");G=G.replace("YUI_AMP","&");G=YAHOO.lang.trim(G);if(this.get("removeLineBreaks")){G=G.replace(/\n/g,"").replace(/\r/g,"");G=G.replace(/ /gi," ");}if(G.substring(0,6).toLowerCase()==""){G=G.substring(6);if(G.substring(G.length-7,G.length).toLowerCase()==""){G=G.substring(0,G.length-7);}}for(var E in this.invalidHTML){if(YAHOO.lang.hasOwnProperty(this.invalidHTML,E)){if(D.isObject(E)&&E.keepContents){G=G.replace(new RegExp("<"+E+"([^>]*)>(.*?)","gi"),"$1");}else{G=G.replace(new RegExp("<"+E+"([^>]*)>(.*?)","gi"),"");}}}this.fireEvent("cleanHTML",{type:"cleanHTML",target:this,html:G});return G;},filter_invalid_lists:function(E){E=E.replace(/<\/li>\n/gi,"
  • ");E=E.replace(/<\/li>
      /gi,"
      1. ");E=E.replace(/<\/ol>/gi,"
    1. ");E=E.replace(/<\/ol><\/li>\n/gi,"
    \n");E=E.replace(/<\/li>
      /gi,"
      • ");E=E.replace(/<\/ul>/gi,"
    • ");E=E.replace(/<\/ul><\/li>\n?/gi,"
    \n");E=E.replace(/<\/li>/gi,"\n");E=E.replace(/<\/ol>/gi,"\n");E=E.replace(/
      /gi,"
        \n");E=E.replace(/
          /gi,"
            \n");return E;},filter_safari:function(E){if(this.browser.webkit){E=E.replace(/([^>])<\/span>/gi,"    ");E=E.replace(/Apple-style-span/gi,"");E=E.replace(/style="line-height: normal;"/gi,"");E=E.replace(/
          • <\/li>/gi,"");E=E.replace(/
          • <\/li>/gi,"");E=E.replace(/
          • <\/li>/gi,"");if(this.get("ptags")){E=E.replace(/]*)>/g,"");E=E.replace(/<\/div>/gi,"

            ");}else{E=E.replace(/
            /gi,"");E=E.replace(/<\/div>/gi,"
            ");}}return E;},filter_internals:function(E){E=E.replace(/\r/g,"");E=E.replace(/<\/?(body|head|html)[^>]*>/gi,"");E=E.replace(/<\/li>/gi,"
          • ");E=E.replace(/yui-tag-span/gi,"");E=E.replace(/yui-tag/gi,"");E=E.replace(/yui-non/gi,"");E=E.replace(/yui-img/gi,"");E=E.replace(/ tag="span"/gi,"");E=E.replace(/ class=""/gi,"");E=E.replace(/ style=""/gi,"");E=E.replace(/ class=" "/gi,"");E=E.replace(/ class=" "/gi,"");E=E.replace(/ target=""/gi,"");E=E.replace(/ title=""/gi,"");if(this.browser.ie){E=E.replace(/ class= /gi,"");E=E.replace(/ class= >/gi,"");E=E.replace(/_height="([^>])"/gi,"");E=E.replace(/_width="([^>])"/gi,"");}return E;},filter_all_rgb:function(I){var H=new RegExp("rgb\\s*?\\(\\s*?([0-9]+).*?,\\s*?([0-9]+).*?,\\s*?([0-9]+).*?\\)","gi");var E=I.match(H);if(D.isArray(E)){for(var G=0;G/gi,"");F=F.replace(/
            /gi,"");}F=F.replace(/
            /gi,"");F=F.replace(/
            /gi,"");F=F.replace(//gi,"");F=F.replace(/
            /gi,"");F=F.replace(/
            <\/div>/gi,"");F=F.replace(/

            ( | )<\/p>/g,"");F=F.replace(/


             <\/p>/gi,"");F=F.replace(/

             <\/p>/gi,"");F=F.replace(/$/,"");F=F.replace(/<\/p>/g,"

            ");if(this.browser.ie){F=F.replace(/    /g,"\t");}return F;},post_filter_linebreaks:function(F,E){if(E=="xhtml"){F=F.replace(//g,"
            ");}else{F=F.replace(//g,"
            ");}return F;},clearEditorDoc:function(){this._getDoc().body.innerHTML=" ";},openWindow:function(E){},moveWindow:function(){},_closeWindow:function(){},closeWindow:function(){this.toolbar.resetAllButtons();this._focusWindow();},destroy:function(){if(this.resize){this.resize.destroy();}if(this.dd){this.dd.unreg();}if(this.get("panel")){this.get("panel").destroy();}this.saveHTML();this.toolbar.destroy();this.setStyle("visibility","visible");this.setStyle("position","static");this.setStyle("top","");this.setStyle("left","");var E=this.get("element");this.get("element_cont").get("parentNode").replaceChild(E,this.get("element_cont").get("element"));this.get("element_cont").get("element").innerHTML="";this.set("handleSubmit",false);return true;},toString:function(){var E="SimpleEditor";if(this.get&&this.get("element_cont")){E="SimpleEditor (#"+this.get("element_cont").get("id")+")"+((this.get("disabled")?" Disabled":""));}return E;}});YAHOO.widget.EditorInfo={_instances:{},blankImage:"",window:{},panel:null,getEditorById:function(E){if(!YAHOO.lang.isString(E)){E=E.id;}if(this._instances[E]){return this._instances[E];}return false;},toString:function(){var E=0;for(var F in this._instances){if(D.hasOwnProperty(this._instances,F)){E++;}}return"Editor Info ("+E+" registered intance"+((E>1)?"s":"")+")"; }};})();YAHOO.register("simpleeditor",YAHOO.widget.SimpleEditor,{version:"2.6.0",build:"1321"});