if(!WYMeditor)var WYMeditor={};!function(){if(window.console&&console.firebug)WYMeditor.console=window.console;else{var a=["log","debug","info","warn","error","assert","dir","dirxml","group","groupEnd","time","timeEnd","count","trace","profile","profileEnd"];WYMeditor.console={};for(var b=0;b
"+WYMeditor.TOOLS+"
"+WYMeditor.CONTAINERS+WYMeditor.CLASSES+"
"+WYMeditor.HTML+WYMeditor.IFRAME+WYMeditor.STATUS+"
"+WYMeditor.LOGO+"
",logoHtml:"WYMeditor",iframeHtml:"
",editorStyles:[],toolsHtml:"

{Tools}

",toolsItemHtml:"
  • "+WYMeditor.TOOL_TITLE+"
  • ",toolsItems:[{name:"Bold",title:"Strong",css:"wym_tools_strong"},{name:"Italic",title:"Emphasis",css:"wym_tools_emphasis"},{name:"Superscript",title:"Superscript",css:"wym_tools_superscript"},{name:"Subscript",title:"Subscript",css:"wym_tools_subscript"},{name:"InsertOrderedList",title:"Ordered_List",css:"wym_tools_ordered_list"},{name:"InsertUnorderedList",title:"Unordered_List",css:"wym_tools_unordered_list"},{name:"Indent",title:"Indent",css:"wym_tools_indent"},{name:"Outdent",title:"Outdent",css:"wym_tools_outdent"},{name:"Undo",title:"Undo",css:"wym_tools_undo"},{name:"Redo",title:"Redo",css:"wym_tools_redo"},{name:"CreateLink",title:"Link",css:"wym_tools_link"},{name:"Unlink",title:"Unlink",css:"wym_tools_unlink"},{name:"InsertImage",title:"Image",css:"wym_tools_image"},{name:"InsertTable",title:"Table",css:"wym_tools_table"},{name:"Paste",title:"Paste_From_Word",css:"wym_tools_paste"},{name:"ToggleHtml",title:"HTML",css:"wym_tools_html"},{name:"Preview",title:"Preview",css:"wym_tools_preview"}],containersHtml:"

    {Containers}

    ",containersItemHtml:"
  • "+WYMeditor.CONTAINER_TITLE+"
  • ",containersItems:[{name:"P",title:"Paragraph",css:"wym_containers_p"},{name:"H1",title:"Heading_1",css:"wym_containers_h1"},{name:"H2",title:"Heading_2",css:"wym_containers_h2"},{name:"H3",title:"Heading_3",css:"wym_containers_h3"},{name:"H4",title:"Heading_4",css:"wym_containers_h4"},{name:"H5",title:"Heading_5",css:"wym_containers_h5"},{name:"H6",title:"Heading_6",css:"wym_containers_h6"},{name:"PRE",title:"Preformatted",css:"wym_containers_pre"},{name:"BLOCKQUOTE",title:"Blockquote",css:"wym_containers_blockquote"},{name:"TH",title:"Table_Header",css:"wym_containers_th"}],classesHtml:"

    {Classes}

    ",classesItemHtml:"
  • "+WYMeditor.CLASS_TITLE+"
  • ",classesItems:[],statusHtml:"

    {Status}

    ",htmlHtml:"

    {Source_Code}

    ",boxSelector:".wym_box",toolsSelector:".wym_tools",toolsListSelector:" ul",containersSelector:".wym_containers",classesSelector:".wym_classes",htmlSelector:".wym_html",iframeSelector:".wym_iframe iframe",iframeBodySelector:".wym_iframe",statusSelector:".wym_status",toolSelector:".wym_tools a",containerSelector:".wym_containers a",classSelector:".wym_classes a",htmlValSelector:".wym_html_val",hrefSelector:".wym_href",srcSelector:".wym_src",titleSelector:".wym_title",altSelector:".wym_alt",textSelector:".wym_text",rowsSelector:".wym_rows",colsSelector:".wym_cols",captionSelector:".wym_caption",summarySelector:".wym_summary",submitSelector:".wym_submit",cancelSelector:".wym_cancel",previewSelector:"",dialogTypeSelector:".wym_dialog_type",dialogLinkSelector:".wym_dialog_link",dialogImageSelector:".wym_dialog_image",dialogTableSelector:".wym_dialog_table",dialogPasteSelector:".wym_dialog_paste",dialogPreviewSelector:".wym_dialog_preview",updateSelector:".wymupdate",updateEvent:"click",dialogFeatures:"menubar=no,titlebar=no,toolbar=no,resizable=no,width=560,height=300,top=0,left=0",dialogFeaturesPreview:"menubar=no,titlebar=no,toolbar=no,resizable=no,scrollbars=yes,width=560,height=300,top=0,left=0",dialogHtml:""+WYMeditor.DIALOG_TITLE+""+WYMeditor.DIALOG_BODY+"",dialogLinkHtml:"
    {Link}
    ",dialogImageHtml:"
    {Image}
    ",dialogTableHtml:"
    {Table}
    ",dialogPasteHtml:"
    {Paste_From_Word}
    ",dialogPreviewHtml:"",dialogStyles:[],stringDelimiterLeft:"{",stringDelimiterRight:"}",preInit:null,preBind:null,postInit:null,preInitDialog:null,postInitDialog:null},a),this.each(function(){new WYMeditor.editor(jQuery(this),a)})},jQuery.extend({wymeditors:function(a){return WYMeditor.INSTANCES[a]}}),WYMeditor.editor.prototype.init=function(){if(jQuery.browser.msie)var WymClass=new WYMeditor.WymClassExplorer(this);else if(jQuery.browser.mozilla)var WymClass=new WYMeditor.WymClassMozilla(this);else if(jQuery.browser.opera)var WymClass=new WYMeditor.WymClassOpera(this);else if(jQuery.browser.safari||jQuery.browser.chrome)var WymClass=new WYMeditor.WymClassSafari(this);if(WymClass){jQuery.isFunction(this._options.preInit)&&this._options.preInit(this);var SaxListener=new WYMeditor.XhtmlSaxListener;jQuery.extend(SaxListener,WymClass),this.parser=new WYMeditor.XhtmlParser(SaxListener),(this._options.styles||this._options.stylesheet)&&this.configureEditorUsingRawCss(),this.helper=new WYMeditor.XmlHelper;for(var prop in WymClass)this[prop]=WymClass[prop];this._box=jQuery(this._element).hide().after(this._options.boxHtml).next().addClass("wym_box_"+this._index),jQuery.isFunction(jQuery.fn.data)&&(jQuery.data(this._box.get(0),WYMeditor.WYM_INDEX,this._index),jQuery.data(this._element.get(0),WYMeditor.WYM_INDEX,this._index));var h=WYMeditor.Helper,iframeHtml=this._options.iframeHtml;iframeHtml=h.replaceAll(iframeHtml,WYMeditor.INDEX,this._index),iframeHtml=h.replaceAll(iframeHtml,WYMeditor.IFRAME_BASE_PATH,this._options.iframeBasePath);var boxHtml=jQuery(this._box).html();boxHtml=h.replaceAll(boxHtml,WYMeditor.LOGO,this._options.logoHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.TOOLS,this._options.toolsHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.CONTAINERS,this._options.containersHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.CLASSES,this._options.classesHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.HTML,this._options.htmlHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.IFRAME,iframeHtml),boxHtml=h.replaceAll(boxHtml,WYMeditor.STATUS,this._options.statusHtml);for(var aTools=eval(this._options.toolsItems),sTools="",i=0;i0&&(h=f.item(0));for(var i=0;g>i;i++)e.parentNode.insertBefore(f.item(0),e);e.parentNode.removeChild(e),h&&this.setFocusToNode(h)}}else this.switchTo(b,a);this.update()}}},WYMeditor.editor.prototype.toggleClass=function(a,b){var c=this._selected_image?this._selected_image:jQuery(this.selected());c=jQuery(c).parentsOrSelf(b),jQuery(c).toggleClass(a),jQuery(c).attr(WYMeditor.CLASS)||jQuery(c).removeAttr(this._class)},WYMeditor.editor.prototype.findUp=function(a,b){if(a){var c=a.tagName.toLowerCase();if(typeof b==WYMeditor.STRING)for(;c!=b&&c!=WYMeditor.BODY;)a=a.parentNode,c=a.tagName.toLowerCase();else for(var d=!1;!d&&c!=WYMeditor.BODY;){for(var e=0;e=0;x--)b=d[x],b=b.replace(e,"
    "),jQuery(c).after("

    "+b+"

    ");else for(x=0;x"),jQuery(this._doc.body).append("

    "+b+"

    ")},WYMeditor.editor.prototype.insert=function(a){null!=this._iframe.contentWindow.getSelection().focusNode?this._exec(WYMeditor.INSERT_HTML,a):this.paste(a)},WYMeditor.editor.prototype.wrap=function(a,b){null!=this._iframe.contentWindow.getSelection().focusNode&&this._exec(WYMeditor.INSERT_HTML,a+this._iframe.contentWindow.getSelection().toString()+b)},WYMeditor.editor.prototype.unwrap=function(){null!=this._iframe.contentWindow.getSelection().focusNode&&this._exec(WYMeditor.INSERT_HTML,this._iframe.contentWindow.getSelection().toString())},WYMeditor.editor.prototype.addCssRules=function(a,b){var c=a.styleSheets[0];if(c)for(var d=0;d0&&(wym._exec(WYMeditor.CREATE_LINK,sStamp),jQuery("a[href="+sStamp+"]",wym._doc.body).attr(WYMeditor.HREF,a).attr(WYMeditor.TITLE,jQuery(wym._options.titleSelector).val())),window.close()}),jQuery(wym._options.dialogImageSelector+" "+wym._options.submitSelector).click(function(){var a=jQuery(wym._options.srcSelector).val();a.length>0&&(wym._exec(WYMeditor.INSERT_IMAGE,sStamp),jQuery("img[src$="+sStamp+"]",wym._doc.body).attr(WYMeditor.SRC,a).attr(WYMeditor.TITLE,jQuery(wym._options.titleSelector).val()).attr(WYMeditor.ALT,jQuery(wym._options.altSelector).val())),window.close()}),jQuery(wym._options.dialogTableSelector+" "+wym._options.submitSelector).click(function(){var a=jQuery(wym._options.rowsSelector).val(),b=jQuery(wym._options.colsSelector).val();if(a>0&&b>0){var c=wym._doc.createElement(WYMeditor.TABLE),d=null,e=jQuery(wym._options.captionSelector).val(),f=c.createCaption();for(f.innerHTML=e,x=0;x":" />")},WYMeditor.XmlHelper.prototype.contentTag=function(a,b,c){return c=c||!1,"<"+a+(c?this.tagOptions(c):"")+">"+b+""},WYMeditor.XmlHelper.prototype.cdataSection=function(a){return""},WYMeditor.XmlHelper.prototype.escapeOnce=function(a){return this._fixDoubleEscape(this.escapeEntities(a))},WYMeditor.XmlHelper.prototype._fixDoubleEscape=function(a){return a.replace(/&([a-z]+|(#\d+));/gi,"&$1;")},WYMeditor.XmlHelper.prototype.tagOptions=function(a){var b=this;b._formated_options="";for(var c in a){var d=a[c];"function"!=typeof d&&d.length>0&&(parseInt(c)==c&&"object"==typeof d&&(c=d.shift(),d=d.pop()),""!=c&&""!=d&&(b._formated_options+=" "+c+'="'+b.escapeOnce(d)+'"'))}return b._formated_options},WYMeditor.XmlHelper.prototype.escapeEntities=function(a,b){this._entitiesDiv.innerHTML=a,this._entitiesDiv.textContent=a;var c=this._entitiesDiv.innerHTML;return"undefined"==typeof b&&(0!=b&&(c=c.replace('"',""")),1==b&&(c=c.replace('"',"'"))),c},WYMeditor.XmlHelper.prototype.parseAttributes=function(a){var b=[],c=a.split(/((=\s*")(")("))|((=\s*\')(\')(\'))|((=\s*[^>\s]*))/g);if(c.toString()!=a)for(var d in c){var e=c[d];if("function"!=typeof e&&0!=e.length){var f=new RegExp("(\\w+)\\s*"+e);if(match=a.match(f)){var g=e.replace(/^[\s=]+/,""),h=g.charAt(0);h='"'==h?'"':"'"==h?"'":"",""!=h&&(g='"'==h?g.replace(/^"|"+$/g,""):g.replace(/^'|'+$/g,"")),a=a.replace(match[0],""),b.push([match[1],g])}}}return b},WYMeditor.XhtmlValidator={_attributes:{core:{except:["base","head","html","meta","param","script","style","title"],attributes:["class","id","style","title","accesskey","tabindex"]},language:{except:["base","br","hr","iframe","param","script"],attributes:{dir:["ltr","rtl"],0:"lang",1:"xml:lang"}},keyboard:{attributes:{accesskey:/^(\w){1}$/,tabindex:/^(\d)+$/}}},_events:{window:{only:["body"],attributes:["onload","onunload"]},form:{only:["form","input","textarea","select","a","label","button"],attributes:["onchange","onsubmit","onreset","onselect","onblur","onfocus"]},keyboard:{except:["base","bdo","br","frame","frameset","head","html","iframe","meta","param","script","style","title"],attributes:["onkeydown","onkeypress","onkeyup"]},mouse:{except:["base","bdo","br","head","html","meta","param","script","style","title"],attributes:["onclick","ondblclick","onmousedown","onmousemove","onmouseover","onmouseout","onmouseup"]}},_tags:{a:{attributes:{0:"charset",1:"coords",2:"href",3:"hreflang",4:"name",rel:/^(alternate|designates|stylesheet|start|next|prev|contents|index|glossary|copyright|chapter|section|subsection|appendix|help|bookmark| |shortcut|icon)+$/,rev:/^(alternate|designates|stylesheet|start|next|prev|contents|index|glossary|copyright|chapter|section|subsection|appendix|help|bookmark| |shortcut|icon)+$/,shape:/^(rect|rectangle|circ|circle|poly|polygon)$/,5:"type"}},0:"abbr",1:"acronym",2:"address",area:{attributes:{0:"alt",1:"coords",2:"href",nohref:/^(true|false)$/,shape:/^(rect|rectangle|circ|circle|poly|polygon)$/},required:["alt"]},3:"b",base:{attributes:["href"],required:["href"]},bdo:{attributes:{dir:/^(ltr|rtl)$/},required:["dir"]},4:"big",blockquote:{attributes:["cite"]},5:"body",6:"br",button:{attributes:{disabled:/^(disabled)$/,type:/^(button|reset|submit)$/,0:"value"},inside:"form"},7:"caption",8:"cite",9:"code",col:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",span:/^(\d)+$/,valign:/^(top|middle|bottom|baseline)$/,2:"width"},inside:"colgroup"},colgroup:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",span:/^(\d)+$/,valign:/^(top|middle|bottom|baseline)$/,2:"width"}},10:"dd",del:{attributes:{0:"cite",datetime:/^([0-9]){8}/}},11:"div",12:"dfn",13:"dl",14:"dt",15:"em",fieldset:{inside:"form"},form:{attributes:{0:"action",1:"accept",2:"accept-charset",3:"enctype",method:/^(get|post)$/},required:["action"]},head:{attributes:["profile"]},16:"h1",17:"h2",18:"h3",19:"h4",20:"h5",21:"h6",22:"hr",html:{attributes:["xmlns"]},23:"i",img:{attributes:["alt","src","height","ismap","longdesc","usemap","width"], required:["alt","src"]},input:{attributes:{0:"accept",1:"alt",checked:/^(checked)$/,disabled:/^(disabled)$/,maxlength:/^(\d)+$/,2:"name",readonly:/^(readonly)$/,size:/^(\d)+$/,3:"src",type:/^(button|checkbox|file|hidden|image|password|radio|reset|submit|text)$/,4:"value"},inside:"form"},ins:{attributes:{0:"cite",datetime:/^([0-9]){8}/}},24:"kbd",label:{attributes:["for"],inside:"form"},25:"legend",26:"li",link:{attributes:{0:"charset",1:"href",2:"hreflang",media:/^(all|braille|print|projection|screen|speech|,|;| )+$/i,rel:/^(alternate|appendix|bookmark|chapter|contents|copyright|glossary|help|home|index|next|prev|section|start|stylesheet|subsection| |shortcut|icon)+$/i,rev:/^(alternate|appendix|bookmark|chapter|contents|copyright|glossary|help|home|index|next|prev|section|start|stylesheet|subsection| |shortcut|icon)+$/i,3:"type"},inside:"head"},map:{attributes:["id","name"],required:["id"]},meta:{attributes:{0:"content","http-equiv":/^(content\-type|expires|refresh|set\-cookie)$/i,1:"name",2:"scheme"},required:["content"]},27:"noscript",object:{attributes:["archive","classid","codebase","codetype","data","declare","height","name","standby","type","usemap","width"]},28:"ol",optgroup:{attributes:{0:"label",disabled:/^(disabled)$/},required:["label"]},option:{attributes:{0:"label",disabled:/^(disabled)$/,selected:/^(selected)$/,1:"value"},inside:"select"},29:"p",param:{attributes:{0:"type",valuetype:/^(data|ref|object)$/,1:"valuetype",2:"value"},required:["name"]},30:"pre",q:{attributes:["cite"]},31:"samp",script:{attributes:{type:/^(text\/ecmascript|text\/javascript|text\/jscript|text\/vbscript|text\/vbs|text\/xml)$/,0:"charset",defer:/^(defer)$/,1:"src"},required:["type"]},select:{attributes:{disabled:/^(disabled)$/,multiple:/^(multiple)$/,0:"name",1:"size"},inside:"form"},32:"small",33:"span",34:"strong",style:{attributes:{0:"type",media:/^(screen|tty|tv|projection|handheld|print|braille|aural|all)$/},required:["type"]},35:"sub",36:"sup",table:{attributes:{0:"border",1:"cellpadding",2:"cellspacing",frame:/^(void|above|below|hsides|lhs|rhs|vsides|box|border)$/,rules:/^(none|groups|rows|cols|all)$/,3:"summary",4:"width"}},tbody:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",valign:/^(top|middle|bottom|baseline)$/}},td:{attributes:{0:"abbr",align:/^(left|right|center|justify|char)$/,1:"axis",2:"char",3:"charoff",colspan:/^(\d)+$/,4:"headers",rowspan:/^(\d)+$/,scope:/^(col|colgroup|row|rowgroup)$/,valign:/^(top|middle|bottom|baseline)$/}},textarea:{attributes:["cols","rows","disabled","name","readonly"],required:["cols","rows"],inside:"form"},tfoot:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",valign:/^(top|middle|bottom)$/,2:"baseline"}},th:{attributes:{0:"abbr",align:/^(left|right|center|justify|char)$/,1:"axis",2:"char",3:"charoff",colspan:/^(\d)+$/,4:"headers",rowspan:/^(\d)+$/,scope:/^(col|colgroup|row|rowgroup)$/,valign:/^(top|middle|bottom|baseline)$/}},thead:{attributes:{align:/^(right|left|center|justify)$/,0:"char",1:"charoff",valign:/^(top|middle|bottom|baseline)$/}},37:"title",tr:{attributes:{align:/^(right|left|center|justify|char)$/,0:"char",1:"charoff",valign:/^(top|middle|bottom|baseline)$/}},38:"tt",39:"ul",40:"var"},skiped_attributes:[],skiped_attribute_values:[],getValidTagAttributes:function(a,b){var c={},d=this.getPossibleTagAttributes(a);for(var e in b){var f=b[e],g=WYMeditor.Helper;g.contains(this.skiped_attributes,e)||g.contains(this.skiped_attribute_values,f)||"function"!=typeof f&&g.contains(d,e)&&(this.doesAttributeNeedsValidation(a,e)?this.validateAttribute(a,e,f)&&(c[e]=f):c[e]=f)}return c},getUniqueAttributesAndEventsForTag:function(a){var b=[];if(this._tags[a]&&this._tags[a].attributes)for(k in this._tags[a].attributes)b.push(parseInt(k)==k?this._tags[a].attributes[k]:k);return b},getDefaultAttributesAndEventsForTags:function(){var a=[];for(var b in this._events)a.push(this._events[b]);for(var b in this._attributes)a.push(this._attributes[b]);return a},isValidTag:function(a){if(this._tags[a])return!0;for(var b in this._tags)if(this._tags[b]==a)return!0;return!1},getDefaultAttributesAndEventsForTag:function(a){var b=[];if(this.isValidTag(a)){var c=this.getDefaultAttributesAndEventsForTags();for(var d in c){var e=c[d];if("object"==typeof e){var f=WYMeditor.Helper;if(e.except&&f.contains(e.except,a)||e.only&&!f.contains(e.only,a))continue;var g=e.attributes?e.attributes:e.events;for(var h in g)b.push("string"!=typeof g[h]?h:g[h])}}}return b},doesAttributeNeedsValidation:function(a,b){return this._tags[a]&&(this._tags[a].attributes&&this._tags[a].attributes[b]||this._tags[a].required&&WYMeditor.Helper.contains(this._tags[a].required,b))},validateAttribute:function(a,b,c){return this._tags[a]&&this._tags[a].attributes&&this._tags[a].attributes[b]&&c.length>0&&!c.match(this._tags[a].attributes[b])||this._tags[a]&&this._tags[a].required&&WYMeditor.Helper.contains(this._tags[a].required,b)&&0==c.length?!1:"undefined"!=typeof this._tags[a]},getPossibleTagAttributes:function(a){return this._possible_tag_attributes||(this._possible_tag_attributes={}),this._possible_tag_attributes[a]||(this._possible_tag_attributes[a]=this.getUniqueAttributesAndEventsForTag(a).concat(this.getDefaultAttributesAndEventsForTag(a))),this._possible_tag_attributes[a]}},WYMeditor.ParallelRegex=function(a){return this._case=a,this._patterns=[],this._labels=[],this._regex=null,this},WYMeditor.ParallelRegex.prototype.addPattern=function(a,b){b=b||!0;var c=this._patterns.length;this._patterns[c]=a,this._labels[c]=b,this._regex=null},WYMeditor.ParallelRegex.prototype.match=function(a){if(0==this._patterns.length)return[!1,""];var b=a.match(this._getCompoundedRegex());if(!b)return[!1,""];for(var c=b[0],d=1;da;a++)this._patterns[a]="("+this._untokenizeRegex(this._tokenizeRegex(this._patterns[a]).replace(/([\/\(\)])/g,"\\$1"))+")";this._regex=new RegExp(this._patterns.join("|"),this._getPerlMatchingFlags())}return this._regex},WYMeditor.ParallelRegex.prototype._tokenizeRegex=function(a){return a.replace(/\(\?(i|m|s|x|U)\)/,"~~~~~~Tk1$1~~~~~~").replace(/\(\?(\-[i|m|s|x|U])\)/,"~~~~~~Tk2$1~~~~~~").replace(/\(\?\=(.*)\)/,"~~~~~~Tk3$1~~~~~~").replace(/\(\?\!(.*)\)/,"~~~~~~Tk4$1~~~~~~").replace(/\(\?\<\=(.*)\)/,"~~~~~~Tk5$1~~~~~~").replace(/\(\?\<\!(.*)\)/,"~~~~~~Tk6$1~~~~~~").replace(/\(\?\:(.*)\)/,"~~~~~~Tk7$1~~~~~~")},WYMeditor.ParallelRegex.prototype._untokenizeRegex=function(a){return a.replace(/~~~~~~Tk1(.{1})~~~~~~/,"(?$1)").replace(/~~~~~~Tk2(.{2})~~~~~~/,"(?$1)").replace(/~~~~~~Tk3(.*)~~~~~~/,"(?=$1)").replace(/~~~~~~Tk4(.*)~~~~~~/,"(?!$1)").replace(/~~~~~~Tk5(.*)~~~~~~/,"(?<=$1)").replace(/~~~~~~Tk6(.*)~~~~~~/,"(?","Comment")},WYMeditor.XhtmlLexer.prototype.addScriptTokens=function(a){this.addEntryPattern("","Script")},WYMeditor.XhtmlLexer.prototype.addCssTokens=function(a){this.addEntryPattern("","Css")},WYMeditor.XhtmlLexer.prototype.addTagTokens=function(a){this.addSpecialPattern("<\\s*[a-z0-9:-]+\\s*>",a,"OpeningTag"),this.addEntryPattern("<[a-z0-9:-]+[\\/ \\>]+",a,"OpeningTag"),this.addInTagDeclarationTokens("OpeningTag"),this.addSpecialPattern("",a,"ClosingTag")},WYMeditor.XhtmlLexer.prototype.addInTagDeclarationTokens=function(a){this.addSpecialPattern("\\s+",a,"Ignore"),this.addAttributeTokens(a),this.addExitPattern("/>",a),this.addExitPattern(">",a)},WYMeditor.XhtmlLexer.prototype.addAttributeTokens=function(a){this.addSpecialPattern("\\s*[a-z-_0-9]*:?[a-z-_0-9]+\\s*(?==)\\s*",a,"TagAttributes"),this.addEntryPattern('=\\s*"',a,"DoubleQuotedAttribute"),this.addPattern('\\\\"',"DoubleQuotedAttribute"),this.addExitPattern('"',"DoubleQuotedAttribute"),this.addEntryPattern("=\\s*'",a,"SingleQuotedAttribute"),this.addPattern("\\\\'","SingleQuotedAttribute"),this.addExitPattern("'","SingleQuotedAttribute"),this.addSpecialPattern("=\\s*[^>\\s]*",a,"UnquotedAttribute")},WYMeditor.XhtmlParser=function(a,b){var b=b||"Text";return this._Lexer=new WYMeditor.XhtmlLexer(this),this._Listener=a,this._mode=b,this._matches=[],this._last_match="",this._current_match="",this},WYMeditor.XhtmlParser.prototype.parse=function(a){return this._Lexer.parse(this.beforeParsing(a)),this.afterParsing(this._Listener.getResult())},WYMeditor.XhtmlParser.prototype.beforeParsing=function(a){return(a.match(/class="MsoNormal"/)||a.match(/ns = "urn:schemas-microsoft-com/))&&this._Listener.avoidStylingTagsAndAttributes(),this._Listener.beforeParsing(a)},WYMeditor.XhtmlParser.prototype.afterParsing=function(a){return this._Listener._avoiding_tags_implicitly&&this._Listener.allowStylingTagsAndAttributes(),this._Listener.afterParsing(a)},WYMeditor.XhtmlParser.prototype.Ignore=function(){return!0},WYMeditor.XhtmlParser.prototype.Text=function(a){return this._Listener.addContent(a),!0},WYMeditor.XhtmlParser.prototype.Comment=function(a,b){return this._addNonTagBlock(a,b,"addComment")},WYMeditor.XhtmlParser.prototype.Script=function(a,b){return this._addNonTagBlock(a,b,"addScript")},WYMeditor.XhtmlParser.prototype.Css=function(a,b){return this._addNonTagBlock(a,b,"addCss")},WYMeditor.XhtmlParser.prototype._addNonTagBlock=function(a,b,c){switch(b){case WYMeditor.LEXER_ENTER:this._non_tag=a;break;case WYMeditor.LEXER_UNMATCHED:this._non_tag+=a;break;case WYMeditor.LEXER_EXIT:switch(c){case"addComment":this._Listener.addComment(this._non_tag+a);break;case"addScript":this._Listener.addScript(this._non_tag+a);break;case"addCss":this._Listener.addCss(this._non_tag+a)}}return!0},WYMeditor.XhtmlParser.prototype.OpeningTag=function(a,b){switch(b){case WYMeditor.LEXER_ENTER:this._tag=this.normalizeTag(a),this._tag_attributes={};break;case WYMeditor.LEXER_SPECIAL:this._callOpenTagListener(this.normalizeTag(a));break;case WYMeditor.LEXER_EXIT:this._callOpenTagListener(this._tag,this._tag_attributes)}return!0},WYMeditor.XhtmlParser.prototype.ClosingTag=function(a){return this._callCloseTagListener(this.normalizeTag(a)),!0},WYMeditor.XhtmlParser.prototype._callOpenTagListener=function(a,b){var b=b||{};this.autoCloseUnclosedBeforeNewOpening(a),this._Listener.isBlockTag(a)?(this._Listener._tag_stack.push(a),this._Listener.fixNestingBeforeOpeningBlockTag(a,b),this._Listener.openBlockTag(a,b),this._increaseOpenTagCounter(a)):this._Listener.isInlineTag(a)?this._Listener.inlineTag(a,b):(this._Listener.openUnknownTag(a,b),this._increaseOpenTagCounter(a)),this._Listener.last_tag=a,this._Listener.last_tag_opened=!0,this._Listener.last_tag_attributes=b},WYMeditor.XhtmlParser.prototype._callCloseTagListener=function(a){if(this._decreaseOpenTagCounter(a))if(this.autoCloseUnclosedBeforeTagClosing(a),this._Listener.isBlockTag(a)){var b=this._Listener._tag_stack.pop();if(0==b)return;b!=a&&(a=b),this._Listener.closeBlockTag(a)}else this._Listener.closeUnknownTag(a);else this._Listener.closeUnopenedTag(a);this._Listener.last_tag=a,this._Listener.last_tag_opened=!1},WYMeditor.XhtmlParser.prototype._increaseOpenTagCounter=function(a){this._Listener._open_tags[a]=this._Listener._open_tags[a]||0,this._Listener._open_tags[a]++},WYMeditor.XhtmlParser.prototype._decreaseOpenTagCounter=function(a){return this._Listener._open_tags[a]?(this._Listener._open_tags[a]--,0==this._Listener._open_tags[a]&&(this._Listener._open_tags[a]=void 0),!0):!1},WYMeditor.XhtmlParser.prototype.autoCloseUnclosedBeforeNewOpening=function(a){this._autoCloseUnclosed(a,!1)},WYMeditor.XhtmlParser.prototype.autoCloseUnclosedBeforeTagClosing=function(a){this._autoCloseUnclosed(a,!0)},WYMeditor.XhtmlParser.prototype._autoCloseUnclosed=function(a,b){var b=b||!1;if(this._Listener._open_tags)for(var c in this._Listener._open_tags){var d=this._Listener._open_tags[c];d>0&&this._Listener.shouldCloseTagAutomatically(c,a,b)&&this._callCloseTagListener(c,!0)}},WYMeditor.XhtmlParser.prototype.getTagReplacements=function(){return this._Listener.getTagReplacements()},WYMeditor.XhtmlParser.prototype.normalizeTag=function(a){a=a.replace(/^([\s<\/>]*)|([\s<\/>]*)$/gm,"").toLowerCase();var b=this._Listener.getTagReplacements();return b[a]?b[a]:a},WYMeditor.XhtmlParser.prototype.TagAttributes=function(a,b){return WYMeditor.LEXER_SPECIAL==b&&(this._current_attribute=a),!0},WYMeditor.XhtmlParser.prototype.DoubleQuotedAttribute=function(a,b){return WYMeditor.LEXER_UNMATCHED==b&&(this._tag_attributes[this._current_attribute]=a),!0},WYMeditor.XhtmlParser.prototype.SingleQuotedAttribute=function(a,b){return WYMeditor.LEXER_UNMATCHED==b&&(this._tag_attributes[this._current_attribute]=a),!0},WYMeditor.XhtmlParser.prototype.UnquotedAttribute=function(a){return this._tag_attributes[this._current_attribute]=a.replace(/^=/,""),!0},WYMeditor.XhtmlSaxListener=function(){return this.output="",this.helper=new WYMeditor.XmlHelper,this._open_tags={},this.validator=WYMeditor.XhtmlValidator,this._tag_stack=[],this.avoided_tags=[],this.entities={" ":" ","¡":"¡","¢":"¢","£":"£","¤":"¤","¥":"¥","¦":"¦","§":"§","¨":"¨","©":"©","ª":"ª","«":"«","¬":"¬","­":"­","®":"®","¯":"¯","°":"°","±":"±","²":"²","³":"³","´":"´","µ":"µ","¶":"¶","·":"·","¸":"¸","¹":"¹","º":"º","»":"»","¼":"¼","½":"½","¾":"¾","¿":"¿","À":"À","Á":"Á","Â":"Â","Ã":"Ã","Ä":"Ä","Å":"Å","Æ":"Æ","Ç":"Ç","È":"È","É":"É","Ê":"Ê","Ë":"Ë","Ì":"Ì","Í":"Í","Î":"Î","Ï":"Ï","Ð":"Ð","Ñ":"Ñ","Ò":"Ò","Ó":"Ó","Ô":"Ô","Õ":"Õ","Ö":"Ö","×":"×","Ø":"Ø","Ù":"Ù","Ú":"Ú","Û":"Û","Ü":"Ü","Ý":"Ý","Þ":"Þ","ß":"ß","à":"à","á":"á","â":"â","ã":"ã","ä":"ä","å":"å","æ":"æ","ç":"ç","è":"è","é":"é","ê":"ê","ë":"ë","ì":"ì","í":"í","î":"î","ï":"ï","ð":"ð","ñ":"ñ","ò":"ò","ó":"ó","ô":"ô","õ":"õ","ö":"ö","÷":"÷","ø":"ø","ù":"ù","ú":"ú","û":"û","ü":"ü","ý":"ý","þ":"þ","ÿ":"ÿ","Œ":"Œ","œ":"œ","Š":"Š","š":"š","Ÿ":"Ÿ","ƒ":"ƒ","ˆ":"ˆ","˜":"˜","Α":"Α","Β":"Β","Γ":"Γ","Δ":"Δ","Ε":"Ε","Ζ":"Ζ","Η":"Η","Θ":"Θ","Ι":"Ι","Κ":"Κ","Λ":"Λ","Μ":"Μ","Ν":"Ν","Ξ":"Ξ","Ο":"Ο","Π":"Π","Ρ":"Ρ","Σ":"Σ","Τ":"Τ","Υ":"Υ","Φ":"Φ","Χ":"Χ","Ψ":"Ψ","Ω":"Ω","α":"α","β":"β","γ":"γ","δ":"δ","ε":"ε","ζ":"ζ","η":"η","θ":"θ","ι":"ι","κ":"κ","λ":"λ","μ":"μ","ν":"ν","ξ":"ξ","ο":"ο","π":"π","ρ":"ρ","ς":"ς","σ":"σ","τ":"τ","υ":"υ","φ":"φ","χ":"χ","ψ":"ψ","ω":"ω","ϑ":"ϑ","ϒ":"ϒ","ϖ":"ϖ"," ":" "," ":" "," ":" ","‌":"‌","‍":"‍","‎":"‎","‏":"‏","–":"–","—":"—","‘":"‘","’":"’","‚":"‚","“":"“","”":"”","„":"„","†":"†","‡":"‡","•":"•","…":"…","‰":"‰","′":"′","″":"″","‹":"‹","›":"›","‾":"‾","⁄":"⁄","€":"€","ℑ":"ℑ","℘":"℘","ℜ":"ℜ","™":"™","ℵ":"ℵ","←":"←","↑":"↑","→":"→","↓":"↓","↔":"↔","↵":"↵","⇐":"⇐","⇑":"⇑","⇒":"⇒","⇓":"⇓","⇔":"⇔","∀":"∀","∂":"∂","∃":"∃","∅":"∅","∇":"∇","∈":"∈","∉":"∉","∋":"∋","∏":"∏","∑":"∑","−":"−","∗":"∗","√":"√","∝":"∝","∞":"∞","∠":"∠","∧":"∧","∨":"∨","∩":"∩","∪":"∪","∫":"∫","∴":"∴","∼":"∼","≅":"≅","≈":"≈","≠":"≠","≡":"≡","≤":"≤","≥":"≥","⊂":"⊂","⊃":"⊃","⊄":"⊄","⊆":"⊆","⊇":"⊇","⊕":"⊕","⊗":"⊗","⊥":"⊥","⋅":"⋅","⌈":"⌈","⌉":"⌉","⌊":"⌊","⌋":"⌋","⟨":"〈","⟩":"〉","◊":"◊","♠":"♠","♣":"♣","♥":"♥","♦":"♦"},this.block_tags=["a","abbr","acronym","address","area","b","base","bdo","big","blockquote","body","button","caption","cite","code","col","colgroup","dd","del","div","dfn","dl","dt","em","fieldset","form","head","h1","h2","h3","h4","h5","h6","html","i","ins","kbd","label","legend","li","map","noscript","object","ol","optgroup","option","p","param","pre","q","samp","script","select","small","span","strong","style","sub","sup","table","tbody","td","textarea","tfoot","th","thead","title","tr","tt","ul","var","extends"],this.inline_tags=["br","hr","img","input"],this},WYMeditor.XhtmlSaxListener.prototype.shouldCloseTagAutomatically=function(a,b,c){var c=c||!1;return"td"==a&&(c&&"tr"==b||!c&&"td"==b)?!0:"option"==a&&(c&&"select"==b||!c&&"option"==b)?!0:!1},WYMeditor.XhtmlSaxListener.prototype.beforeParsing=function(a){return this.output="",a},WYMeditor.XhtmlSaxListener.prototype.afterParsing=function(a){return a=this.replaceNamedEntities(a),a=this.joinRepeatedEntities(a),a=this.removeEmptyTags(a),a=this.removeBrInPre(a)},WYMeditor.XhtmlSaxListener.prototype.replaceNamedEntities=function(a){for(var b in this.entities)a=a.replace(new RegExp(b,"g"),this.entities[b]);return a},WYMeditor.XhtmlSaxListener.prototype.joinRepeatedEntities=function(a){var b="em|strong|sub|sup|acronym|pre|del|address";return a.replace(new RegExp("<\\1>",""),"").replace(new RegExp("(s*<("+b+")>s*){2}(.*)(s*s*){2}",""),"<$2>$3<$2>")},WYMeditor.XhtmlSaxListener.prototype.removeEmptyTags=function(a){return a.replace(new RegExp("<("+this.block_tags.join("|").replace(/\|td/,"").replace(/\|p/,"").replace(/\|th/,"")+")>(
    | | |\\s)*","g"),"")},WYMeditor.XhtmlSaxListener.prototype.removeBrInPre=function(a){var b=a.match(new RegExp("]*>(.*?)","gmi"));if(b)for(var c=0;c","g"),String.fromCharCode(13,10)));return a},WYMeditor.XhtmlSaxListener.prototype.getResult=function(){return this.output},WYMeditor.XhtmlSaxListener.prototype.getTagReplacements=function(){return{b:"strong",i:"em"}},WYMeditor.XhtmlSaxListener.prototype.addContent=function(a){this.output+=a},WYMeditor.XhtmlSaxListener.prototype.addComment=function(a){this.remove_comments&&(this.output+=a)},WYMeditor.XhtmlSaxListener.prototype.addScript=function(a){this.remove_scripts||(this.output+=a)},WYMeditor.XhtmlSaxListener.prototype.addCss=function(a){this.remove_embeded_styles||(this.output+=a)},WYMeditor.XhtmlSaxListener.prototype.openBlockTag=function(a,b){this.output+=this.helper.tag(a,this.validator.getValidTagAttributes(a,b),!0)},WYMeditor.XhtmlSaxListener.prototype.inlineTag=function(a,b){this.output+=this.helper.tag(a,this.validator.getValidTagAttributes(a,b))},WYMeditor.XhtmlSaxListener.prototype.openUnknownTag=function(){},WYMeditor.XhtmlSaxListener.prototype.closeBlockTag=function(a){this.output=this.output.replace(/
    $/,"")+this._getClosingTagContent("before",a)+""+this._getClosingTagContent("after",a)},WYMeditor.XhtmlSaxListener.prototype.closeUnknownTag=function(){},WYMeditor.XhtmlSaxListener.prototype.closeUnopenedTag=function(a){this.output+=""},WYMeditor.XhtmlSaxListener.prototype.avoidStylingTagsAndAttributes=function(){this.avoided_tags=["div","span"],this.validator.skiped_attributes=["style"],this.validator.skiped_attribute_values=["MsoNormal","main1"],this._avoiding_tags_implicitly=!0},WYMeditor.XhtmlSaxListener.prototype.allowStylingTagsAndAttributes=function(){this.avoided_tags=[],this.validator.skiped_attributes=[],this.validator.skiped_attribute_values=[],this._avoiding_tags_implicitly=!1},WYMeditor.XhtmlSaxListener.prototype.isBlockTag=function(a){return!WYMeditor.Helper.contains(this.avoided_tags,a)&&WYMeditor.Helper.contains(this.block_tags,a)},WYMeditor.XhtmlSaxListener.prototype.isInlineTag=function(a){return!WYMeditor.Helper.contains(this.avoided_tags,a)&&WYMeditor.Helper.contains(this.inline_tags,a)},WYMeditor.XhtmlSaxListener.prototype.insertContentAfterClosingTag=function(a,b){this._insertContentWhenClosingTag("after",a,b)},WYMeditor.XhtmlSaxListener.prototype.insertContentBeforeClosingTag=function(a,b){this._insertContentWhenClosingTag("before",a,b)},WYMeditor.XhtmlSaxListener.prototype.fixNestingBeforeOpeningBlockTag=function(a){"li"==a||"ul"!=a&&"ol"!=a||!this.last_tag||this.last_tag_opened||"li"!=this.last_tag||(this.output=this.output.replace(/<\/li>$/,""),this.insertContentAfterClosingTag(a,""))},WYMeditor.XhtmlSaxListener.prototype._insertContentWhenClosingTag=function(a,b,c){this["_insert_"+a+"_closing"]||(this["_insert_"+a+"_closing"]=[]),this["_insert_"+a+"_closing"][b]||(this["_insert_"+a+"_closing"][b]=[]),this["_insert_"+a+"_closing"][b].push(c)},WYMeditor.XhtmlSaxListener.prototype._getClosingTagContent=function(a,b){return this["_insert_"+a+"_closing"]&&this["_insert_"+a+"_closing"][b]&&this["_insert_"+a+"_closing"][b].length>0?this["_insert_"+a+"_closing"][b].pop():""},WYMeditor.WymCssLexer=function(a,b){var b="undefined"==typeof b?!0:b;return jQuery.extend(this,new WYMeditor.Lexer(a,b?"Ignore":"WymCss")),this.mapHandler("WymCss","Ignore"),1==b&&(this.addEntryPattern("/\\*[<\\s]*WYMeditor[>\\s]*\\*/","Ignore","WymCss"),this.addExitPattern("/\\*[\\s]*\\*/","WymCss")),this.addSpecialPattern("[\\sa-z1-6]*\\.[a-z-_0-9]+","WymCss","WymCssStyleDeclaration"),this.addEntryPattern("/\\*","WymCss","WymCssComment"),this.addExitPattern("\\*/","WymCssComment"),this.addEntryPattern("{","WymCss","WymCssStyle"),this.addExitPattern("}","WymCssStyle"),this.addEntryPattern("/\\*","WymCssStyle","WymCssFeedbackStyle"),this.addExitPattern("\\*/","WymCssFeedbackStyle"),this},WYMeditor.WymCssParser=function(){return this._in_style=!1,this._has_title=!1,this.only_wym_blocks=!0,this.css_settings={classesItems:[],editorStyles:[],dialogStyles:[]},this},WYMeditor.WymCssParser.prototype.parse=function(a,b){var b="undefined"==typeof b?this.only_wym_blocks:b;this._Lexer=new WYMeditor.WymCssLexer(this,b),this._Lexer.parse(a)},WYMeditor.WymCssParser.prototype.Ignore=function(){return!0},WYMeditor.WymCssParser.prototype.WymCssComment=function(a,b){return a.match(/end[a-z0-9\s]*wym[a-z0-9\s]*/im)?!1:(b==WYMeditor.LEXER_UNMATCHED&&(this._in_style?this._current_item[this._current_element]&&(this._current_item[this._current_element].expressions?this._current_item[this._current_element].expressions.push(a):this._current_item[this._current_element].expressions=[a]):(this._has_title=!0,this._current_item={title:WYMeditor.Helper.trim(a)}),this._in_style=!0),!0)},WYMeditor.WymCssParser.prototype.WymCssStyle=function(a,b){return b==WYMeditor.LEXER_UNMATCHED?(a=WYMeditor.Helper.trim(a),""!=a&&(this._current_item[this._current_element].style=a)):b==WYMeditor.LEXER_EXIT&&(this._in_style=!1,this._has_title=!1,this.addStyleSetting(this._current_item)),!0},WYMeditor.WymCssParser.prototype.WymCssFeedbackStyle=function(a,b){return b==WYMeditor.LEXER_UNMATCHED&&(this._current_item[this._current_element].feedback_style=a.replace(/^([\s\/\*]*)|([\s\/\*]*)$/gm,"")),!0},WYMeditor.WymCssParser.prototype.WymCssStyleDeclaration=function(a){a=a.replace(/^([\s\.]*)|([\s\.*]*)$/gm,"");var b="";if(a.indexOf(".")>0){var c=a.split(".");this._current_element=c[1];var b=c[0]}else this._current_element=a;return this._has_title||(this._current_item={title:(b?b.toUpperCase()+": ":"")+this._current_element},this._has_title=!0),this._current_item[this._current_element]||(this._current_item[this._current_element]={name:this._current_element}),b&&(this._current_item[this._current_element].tags?this._current_item[this._current_element].tags.push(b):this._current_item[this._current_element].tags=[b]),!0},WYMeditor.WymCssParser.prototype.addStyleSetting=function(a){for(var b in a){var c=a[b];"object"==typeof c&&"title"!=b&&(this.css_settings.classesItems.push({name:WYMeditor.Helper.trim(c.name),title:a.title,expr:WYMeditor.Helper.trim((c.expressions||c.tags).join(", "))}),c.feedback_style&&this.css_settings.editorStyles.push({name:"."+WYMeditor.Helper.trim(c.name),css:c.feedback_style}),c.style&&this.css_settings.dialogStyles.push({name:"."+WYMeditor.Helper.trim(c.name),css:c.style}))}},jQuery.fn.isPhantomNode=function(){return 3==this[0].nodeType?!/[^\t\n\r ]/.test(this[0].data):!1},WYMeditor.isPhantomNode=function(a){return 3==a.nodeType?!/[^\t\n\r ]/.test(a.data):!1},WYMeditor.isPhantomString=function(a){return!/[^\t\n\r ]/.test(a)},jQuery.fn.parentsOrSelf=function(a){var b=this;return 3==b[0].nodeType&&(b=b.parents().slice(0,1)),1==b.filter(a).size()?b:b.parents(a).slice(0,1)},WYMeditor.Helper={replaceAll:function(a,b,c){var d=new RegExp(b,"g");return a.replace(d,c)},insertAt:function(a,b,c){return a.substr(0,c)+b+a.substring(c)},trim:function(a){return a.replace(/^(\s*)|(\s*)$/gm,"")},contains:function(a,b){for(var c=0;c1||d.tagName.toLowerCase()==WYMeditor.OL||d.tagName.toLowerCase()==WYMeditor.UL)&&this._doc.execCommand(a)}break;default:b?this._doc.execCommand(a,!1,b):this._doc.execCommand(a)}this.listen()},WYMeditor.WymClassExplorer.prototype.selected=function(){var a=this._iframe.contentWindow.document.caretPos;return null!=a&&void 0!=a.parentElement?a.parentElement():void 0},WYMeditor.WymClassExplorer.prototype.saveCaret=function(){this._doc.caretPos=this._doc.selection.createRange()},WYMeditor.WymClassExplorer.prototype.addCssRule=function(a,b){a.addRule(b.name,b.css)},WYMeditor.WymClassExplorer.prototype.insert=function(a){var b=this._doc.selection.createRange();if(jQuery(b.parentElement()).parents(this._options.iframeBodySelector).is("*"))try{b.pasteHTML(a)}catch(c){}else this.paste(a)},WYMeditor.WymClassExplorer.prototype.wrap=function(a,b){var c=this._doc.selection.createRange();if(jQuery(c.parentElement()).parents(this._options.iframeBodySelector).is("*"))try{c.pasteHTML(a+c.text+b)}catch(d){}},WYMeditor.WymClassExplorer.prototype.unwrap=function(){var a=this._doc.selection.createRange();if(jQuery(a.parentElement()).parents(this._options.iframeBodySelector).is("*"))try{var b=a.text;this._exec("Cut"),a.pasteHTML(b)}catch(c){}},WYMeditor.WymClassExplorer.prototype.keyup=function(){this._selected_image=null},WYMeditor.WymClassExplorer.prototype.setFocusToNode=function(a){var b=this._doc.selection.createRange();b.moveToElementText(a),b.collapse(!1),b.move("character",-1),b.select(),a.focus()},WYMeditor.WymClassMozilla=function(a){this._wym=a,this._class="class",this._newLine="\n"},WYMeditor.WymClassMozilla.prototype.initIframe=function(iframe){this._iframe=iframe,this._doc=iframe.contentDocument;var styles=this._doc.styleSheets[0],aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss),this._doc.title=this._wym._index,jQuery("html",this._doc).attr("dir",this._options.direction),this.html(this._wym._html),this.enableDesignMode(),jQuery.isFunction(this._options.preBind)&&this._options.preBind(this),this._wym.bindEvents(),jQuery(this._doc).bind("keydown",this.keydown),jQuery(this._doc).bind("keyup",this.keyup),jQuery(this._doc).bind("focus",this.enableDesignMode),jQuery.isFunction(this._options.postInit)&&this._options.postInit(this),this.listen()},WYMeditor.WymClassMozilla.prototype.html=function(a){if("string"!=typeof a)return jQuery(this._doc.body).html();try{this._doc.designMode="off"}catch(b){}a=a.replace(/]*)>/gi,"").replace(/<\/em>/gi,"").replace(/]*)>/gi,"").replace(/<\/strong>/gi,""),jQuery(this._doc.body).html(a),this.enableDesignMode()},WYMeditor.WymClassMozilla.prototype._exec=function(a,b){if(!this.selected())return!1;switch(a){case WYMeditor.INDENT:case WYMeditor.OUTDENT:var c=this.selected(),d=this._iframe.contentWindow.getSelection(),e=d.anchorNode;if("#text"==e.nodeName&&(e=e.parentNode),c=this.findUp(c,WYMeditor.BLOCKS),e=this.findUp(e,WYMeditor.BLOCKS),c&&c==e&&c.tagName.toLowerCase()==WYMeditor.LI){var f=c.parentNode.parentNode;(c.parentNode.childNodes.length>1||f.tagName.toLowerCase()==WYMeditor.OL||f.tagName.toLowerCase()==WYMeditor.UL)&&this._doc.execCommand(a,"",null)}break;default:b?this._doc.execCommand(a,"",b):this._doc.execCommand(a,"",null)}var g=this.selected();g.tagName.toLowerCase()==WYMeditor.BODY&&this._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P),this.listen()},WYMeditor.WymClassMozilla.prototype.selected=function(){var a=this._iframe.contentWindow.getSelection(),b=a.focusNode;return b?"#text"==b.nodeName?b.parentNode:b:null},WYMeditor.WymClassMozilla.prototype.addCssRule=function(a,b){a.insertRule(b.name+" {"+b.css+"}",a.cssRules.length)},WYMeditor.WymClassMozilla.prototype.keydown=function(a){var b=WYMeditor.INSTANCES[this.title],c=null;if(a.keyCode===WYMeditor.KEY.ENTER&&(c=b.selected())){var d=$(c),e=(d.parent(),d.parents(".embedded-item"));if(e.size()){var f=$("

    ");return d.hasClass("title")?e.before(f):d.hasClass("content")&&e.after(f),b.setFocusToNode(f.get(0)),!1}}if(a.ctrlKey){if(66==a.keyCode)return b._exec(WYMeditor.BOLD),!1;if(73==a.keyCode)return b._exec(WYMeditor.ITALIC),!1}else 13==a.keyCode&&(a.shiftKey||(c=b.selected(),c&&c.tagName.toLowerCase()==WYMeditor.PRE&&(a.preventDefault(),b.insert("

    "))))},WYMeditor.WymClassMozilla.prototype.keyup=function(a){var b=WYMeditor.INSTANCES[this.title];b._selected_image=null;var c=null;if(13!=a.keyCode||a.shiftKey){if(8!=a.keyCode&&17!=a.keyCode&&46!=a.keyCode&&224!=a.keyCode&&!a.metaKey&&!a.ctrlKey){c=b.selected();var d=c.tagName.toLowerCase();("strong"==d||"b"==d||"em"==d||"i"==d||"sub"==d||"sup"==d||"a"==d)&&(d=c.parentNode.tagName.toLowerCase()),d==WYMeditor.BODY&&b._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P)}}else jQuery(b._doc.body).children(WYMeditor.BR).remove()},WYMeditor.WymClassMozilla.prototype.enableDesignMode=function(){if("off"==this.designMode)try{this.designMode="on",this.execCommand("styleWithCSS","",!1)}catch(a){}},WYMeditor.WymClassMozilla.prototype.setFocusToNode=function(a){var b=document.createRange();b.selectNode(a);var c=this._iframe.contentWindow.getSelection();c.addRange(b),c.collapse(a,a.childNodes.length),this._iframe.contentWindow.focus()},WYMeditor.WymClassMozilla.prototype.openBlockTag=function(a,b){var b=this.validator.getValidTagAttributes(a,b);if("span"==a&&b.style){var c=this.getTagForStyle(b.style);if(!c)return;this._tag_stack.pop();var a=c;this._tag_stack.push(c),b.style=""}this.output+=this.helper.tag(a,b,!0)},WYMeditor.WymClassMozilla.prototype.getTagForStyle=function(a){return/bold/.test(a)?"strong":/italic/.test(a)?"em":/sub/.test(a)?"sub":/sub/.test(a)?"super":!1},WYMeditor.WymClassOpera=function(a){this._wym=a,this._class="class",this._newLine="\r\n"},WYMeditor.WymClassOpera.prototype.initIframe=function(iframe){this._iframe=iframe,this._doc=iframe.contentWindow.document;var styles=this._doc.styleSheets[0],aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss),this._doc.title=this._wym._index,jQuery("html",this._doc).attr("dir",this._options.direction),this._doc.designMode="on",this.html(this._wym._html),jQuery.isFunction(this._options.preBind)&&this._options.preBind(this),this._wym.bindEvents(),jQuery(this._doc).bind("keydown",this.keydown),jQuery(this._doc).bind("keyup",this.keyup),jQuery.isFunction(this._options.postInit)&&this._options.postInit(this),this.listen()},WYMeditor.WymClassOpera.prototype._exec=function(a,b){b?this._doc.execCommand(a,!1,b):this._doc.execCommand(a),this.listen()},WYMeditor.WymClassOpera.prototype.selected=function(){var a=this._iframe.contentWindow.getSelection(),b=a.focusNode;return b?"#text"==b.nodeName?b.parentNode:b:null},WYMeditor.WymClassOpera.prototype.addCssRule=function(a,b){a.insertRule(b.name+" {"+b.css+"}",a.cssRules.length)},WYMeditor.WymClassOpera.prototype.keydown=function(a){var b=WYMeditor.INSTANCES[this.title],c=b._iframe.contentWindow.getSelection();startNode=c.getRangeAt(0).startContainer,jQuery(startNode).parentsOrSelf(WYMeditor.MAIN_CONTAINERS.join(","))[0]||jQuery(startNode).parentsOrSelf("li")||a.keyCode==WYMeditor.KEY.ENTER||a.keyCode==WYMeditor.KEY.LEFT||a.keyCode==WYMeditor.KEY.UP||a.keyCode==WYMeditor.KEY.RIGHT||a.keyCode==WYMeditor.KEY.DOWN||a.keyCode==WYMeditor.KEY.BACKSPACE||a.keyCode==WYMeditor.KEY.DELETE||b._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P)},WYMeditor.WymClassOpera.prototype.keyup=function(){var a=WYMeditor.INSTANCES[this.title];a._selected_image=null},WYMeditor.WymClassOpera.prototype.setFocusToNode=function(){},WYMeditor.WymClassSafari=function(a){this._wym=a,this._class="class",this._newLine="\n"},WYMeditor.WymClassSafari.prototype.initIframe=function(iframe){this._iframe=iframe,this._doc=iframe.contentDocument;var styles=this._doc.styleSheets[0],aCss=eval(this._options.editorStyles);this.addCssRules(this._doc,aCss),this._doc.title=this._wym._index,jQuery("html",this._doc).attr("dir",this._options.direction),this._doc.designMode="on",this.html(this._wym._html),jQuery.isFunction(this._options.preBind)&&this._options.preBind(this),this._wym.bindEvents(),jQuery(this._doc).bind("keydown",this.keydown),jQuery(this._doc).bind("keyup",this.keyup),jQuery.isFunction(this._options.postInit)&&this._options.postInit(this),this.listen()},WYMeditor.WymClassSafari.prototype._exec=function(a,b){if(!this.selected())return!1;switch(a){case WYMeditor.INDENT:case WYMeditor.OUTDENT:var c=this.selected(),d=this._iframe.contentWindow.getSelection(),e=d.anchorNode;if("#text"==e.nodeName&&(e=e.parentNode),c=this.findUp(c,WYMeditor.BLOCKS),e=this.findUp(e,WYMeditor.BLOCKS),c&&c==e&&c.tagName.toLowerCase()==WYMeditor.LI){var f=c.parentNode.parentNode;(c.parentNode.childNodes.length>1||f.tagName.toLowerCase()==WYMeditor.OL||f.tagName.toLowerCase()==WYMeditor.UL)&&this._doc.execCommand(a,"",null)}break;case WYMeditor.INSERT_ORDEREDLIST:case WYMeditor.INSERT_UNORDEREDLIST:this._doc.execCommand(a,"",null);var c=this.selected(),g=this.findUp(c,WYMeditor.MAIN_CONTAINERS);g&&jQuery(g).replaceWith(jQuery(g).html());break;default:b?this._doc.execCommand(a,"",b):this._doc.execCommand(a,"",null)}var g=this.selected();g&&g.tagName.toLowerCase()==WYMeditor.BODY&&this._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P),this.listen()},WYMeditor.WymClassSafari.prototype.selected=function(){var a=this._iframe.contentWindow.getSelection(),b=a.focusNode;return b?"#text"==b.nodeName?b.parentNode:b:null},WYMeditor.WymClassSafari.prototype.addCssRule=function(a,b){a.insertRule(b.name+" {"+b.css+"}",a.cssRules.length)},WYMeditor.WymClassSafari.prototype.keydown=function(a){var b=WYMeditor.INSTANCES[this.title];if(a.keyCode===WYMeditor.KEY.ENTER){var c=b.selected();if(c){var d=$(c),e=(d.parent(),d.parents(".embedded-item"));if(e.size()){var f=$("

    ");return d.hasClass("title")?e.before(f):d.hasClass("content")&&e.after(f),b.setFocusToNode(f.get(0)),!1}}}if(a.ctrlKey){if(66==a.keyCode)return b._exec(WYMeditor.BOLD),!1;if(73==a.keyCode)return b._exec(WYMeditor.ITALIC),!1}},WYMeditor.WymClassSafari.prototype.keyup=function(a){var b=WYMeditor.INSTANCES[this.title];b._selected_image=null;var c=null;if(13!=a.keyCode||a.shiftKey||(jQuery(b._doc.body).children(WYMeditor.BR).remove(),c=b.selected(),c&&c.tagName.toLowerCase()==WYMeditor.PRE&&b._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P)),13==a.keyCode&&a.shiftKey&&b._exec("InsertLineBreak"),8!=a.keyCode&&17!=a.keyCode&&46!=a.keyCode&&224!=a.keyCode&&!a.metaKey&&!a.ctrlKey){c=b.selected();var d=c.tagName.toLowerCase();("strong"==d||"b"==d||"em"==d||"i"==d||"sub"==d||"sup"==d||"a"==d||"span"==d)&&(d=c.parentNode.tagName.toLowerCase()),(d==WYMeditor.BODY||d==WYMeditor.DIV)&&b._exec(WYMeditor.FORMAT_BLOCK,WYMeditor.P)}},WYMeditor.WymClassSafari.prototype.setFocusToNode=function(a){var b=this._iframe.contentDocument.createRange();b.selectNode(a);var c=this._iframe.contentWindow.getSelection();c.addRange(b),c.collapse(a,a.childNodes.length),this._iframe.contentWindow.focus()},WYMeditor.WymClassSafari.prototype.openBlockTag=function(a,b){var b=this.validator.getValidTagAttributes(a,b);if("span"==a&&b.style){var c=this.getTagForStyle(b.style);if(!c)return;this._tag_stack.pop();var a=c;this._tag_stack.push(c),b.style="","string"==typeof b.class&&(b.class=b.class.replace(/apple-style-span/gi,""))}this.output+=this.helper.tag(a,b,!0)},WYMeditor.WymClassSafari.prototype.getTagForStyle=function(a){return/bold/.test(a)?"strong":/italic/.test(a)?"em":/sub/.test(a)?"sub":/super/.test(a)?"sup":!1}; //# sourceMappingURL=../../../maps/libs/jquery/jquery.wymeditor.js.map